Intra prediction method and device

ABSTRACT

The present invention relates to an intra prediction method and apparatus. The image decoding method according to the present invention may comprise decoding information on intra prediction; and generating a prediction block by performing intra prediction for a current block based on the information on intra prediction. The information on intra prediction may include information on an intra prediction mode, and the intra prediction mode may include a curved intra prediction mode.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation Application of U.S. patentapplication Ser. No. 17/401,578, filed on Aug. 13, 2021, which is aContinuation Application of U.S. patent application Ser. No. 16/099,639,filed on Nov. 7, 2018, now U.S. Pat. No. 11,128,861, which is a U.S.national stage application of International Application No.PCT/KR2017/006241 filed on Jun. 15, 2017, which claims the benefit ofKorean Patent Application No. 10-2016-0078272, filed on Jun. 22, 2016,and Korean Patent Application No. 10-2016-0099618, filed on Aug. 4,2016, in the Korean Intellectual Property Office, the entire disclosuresof which are all incorporated by reference for all purposes.

TECHNICAL FIELD

The present invention relates to a method and apparatus forencoding/decoding an image. Particularly, the present invention relatesto a method and apparatus for intra prediction, more specifically,curved intra prediction.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra high definition (UHD) images, haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image encoding/decoding techniques arerequired for higher-resolution and higher-quality images.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; a transform and quantization technique for compressing energyof a residual signal; an entropy encoding technique of assigning a shortcode to a value with a high appearance frequency and assigning a longcode to a value with a low appearance frequency; etc. image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

In conventional intra prediction, when performing directional intraprediction, only straight-directional prediction is used and thus thereare limitations to enhance encoding efficiency.

DISCLOSURE Technical Problem

The present invention is intended to provide an encoding/decoding methodand apparatus for improving efficiency of encoding/decoding an image.

The present invention is intended to provide an encoding/decoding methodand apparatus for improving efficiency of intra prediction.

The present invention is intended to provide a method and apparatus forperforming straight-directional prediction and/or curved directionalwhen performing intra prediction.

Technical Solution

An image decoding method according to the present invention maycomprise: decoding information on intra prediction; and generating aprediction block by performing intra prediction for a current blockbased on the information on intra prediction.

According to an image decoding method of the present invention, theinformation on intra prediction may include information on an intraprediction mode, and the intra prediction mode may include a curvedintra prediction mode.

According to an image decoding method of the present invention, theintra prediction mode of the current block may be a curved intraprediction mode, and the information on intra prediction may includedirection information

According to an image decoding method of the present invention, theinformation on intra prediction may include information specifying aposition of a reference pixel.

According to an image decoding method of the present invention, thecurrent block may include at least one pixel group including at leastone pixel, and the information specifying the position of the referencepixel may be assigned in a unit of the pixel group.

According to an image decoding method of the present invention, thepixel group may be configured in a unit of at least one of a pixel unit,a horizontal line unit, a vertical line unit, a diagonal line unit, aright angle line unit, and a sub-block unit, each being included in thecurrent block.

According to an image decoding method of the present invention, theinformation specifying the position of the reference pixel may includeinformation on at least one curvature parameter or at least one weightparameter.

According to an image decoding method of the present invention, theinformation specifying the position of the reference pixel may bedecoded based on at least one neighboring block of the current block.

According to an image decoding method of the present invention, the atleast one curvature parameter or the at least one weight parameter isdecoded by using a default value and a delta value.

According to an image decoding method of the present invention, theinformation on intra prediction may include information on applicationof curved intra prediction, the information on application of curvedintra prediction may be decoded in a predetermined unit, and thepredetermined unit may be at least one of a video, a sequence, apicture, a slice, a tile, a coding tree unit, a coding unit, aprediction unit and a transform unit.

An image decoding apparatus according to the present invention maycomprise a decoder for decoding information on intra prediction; and anintra predictor for generating a prediction block by performing intraprediction for a current block based on the information on intraprediction.

According to an image decoding apparatus of the present invention, theinformation on intra prediction may include information on an intraprediction mode, and the intra prediction mode may include a curvedintra prediction mode.

An image encoding method according to the present invention maycomprise: generating a prediction block by performing intra predictionfor a current block; and encoding information on the intra prediction.

According to an image encoding method of the present invention, theinformation on intra prediction may include information on an intraprediction mode, and the intra prediction mode may include a curvedintra prediction mode.

According to an image encoding method of the present invention, theintra prediction mode of the current block may be a curved intraprediction mode, and the information on intra prediction may includedirection information.

According to an image encoding method of the present invention, theinformation on intra prediction may include information specifying aposition of a reference pixel.

According to an image encoding method of the present invention, thecurrent block may include at least one pixel group including at leastone pixel, and the information specifying the position of the referencepixel may be assigned in a unit of the pixel group.

According to an image encoding method of the present invention, thepixel group may be configured in a unit of at least one of a pixel unit,a horizontal line unit, a vertical line unit, a diagonal line unit, aright angle line unit, and a sub-block unit, each being included in thecurrent block.

According to an image encoding method of the present invention, theinformation specifying the position of the reference pixel may includeinformation on at least one curvature parameter or at least one weightparameter.

According to an image encoding method of the present invention, theinformation specifying the position of the reference pixel may beencoded based on at least one neighboring block of the current block.

According to an image encoding method of the present invention, the atleast one curvature parameter or the at least one weight parameter maybe encoded by using a default value and a delta value.

An image encoding apparatus according to the present invention maycomprise an intra predictor for generating a prediction block byperforming intra prediction for a current block; and an encoder forencoding information on the intra prediction.

According to an image encoding apparatus of the present invention, theinformation on intra prediction may include information on an intraprediction mode, and the intra prediction mode may include a curvedintra prediction mode

A recording medium according to the present invention may store abitstream generated by an image encoding method according to the presentinvention.

Advantageous Effects

By the present invention, efficiency of encoding/decoding an image maybe improved.

By the present invention, encoding/decoding efficiency of intraprediction of an image may be improved.

By the present invention, intra prediction may be performed by usingstraight-directional prediction and/or curved prediction.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing configurations of an encodingapparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram showing configurations of a decoding apparatusaccording to an embodiment of the present invention.

FIG. 3 is a view schematically showing a partition structure of animage: when encoding and decoding the image.

FIG. 4 is a view showing forms of a prediction unit (PU) that may beincluded in a coding unit (CU).

FIG. 5 is a view showing forms of a transform unit (U) that may beincluded in a coding unit (CU).

FIG. 6 is a view for explaining an embodiment of a process of intraprediction.

FIG. 7 is a view for explaining an embodiment of a process of interprediction.

FIG. 8 is a view for explaining transform sets according tointra-prediction modes.

FIG. 9 is a view for explaining a process of transform.

FIG. 10 is a view for explaining scanning of quantized transformcoefficients.

FIG. 11 is a view for explaining block partition.

FIG. 12 is a view showing an operation of an encoding apparatusperforming an intra prediction method according to the presentinvention.

FIG. 13 is a view showing an operation of a decoding apparatusperforming an intra prediction method according to the presentinvention.

FIG. 14 is a view showing a pixel that may be used for configuring areference pixel array p_(ref) for intra prediction.

FIG. 15 is a view showing an embodiment of replacing a “non-availablereference pixel candidate” to a pixel value of an “available referencepixel candidate”.

FIG. 16 is a view exemplary showing a threshold valuentraHorVerDistThresh assigned to a block size N_(s).

FIG. 17 is a view showing whether or not to perform filtering forreference pixels according to a block size and a directional predictionmode of a current block.

FIG. 18 is a view showing intra prediction when an intra prediction modeis a non-directional planar mode INTRA_PLANAR.

FIG. 19 is a view showing intra prediction when an intra prediction modeis a non-directional DC mode INTRA_DC.

FIG. 20 is a view showing an embodiment of angles between eachstraight-directional mode and a vertical direction among intraprediction modes predModeIntra including 33 straight-directional modes.

FIG. 21 is a view illustrating an example of generating aone-dimensional reference pixel array p_(1,ref) from p_(ref).

FIG. 22 is a view showing an embodiment of generating p_(1,ref) for a4×4 block when a straight-directional mode is a horizontal direction.

FIG. 23 is a view showing an embodiment of generating prier for a 4×4block when a straight-directional mode is a vertical direction.

FIG. 24 is a view showing an embodiment of filtering boundaryrows/columns of a prediction block when the prediction mode is avertical direction.

FIG. 25 is a view showing an embodiment using reference pixels havingdifferent angles according to a position of a pixel within theprediction block.

FIG. 26 is a view showing an embodiment of a reference pixel of aplurality of lines, the reference pixel being used for intra predictionof the current block.

FIG. 27 is a view showing an embodiment of performing curved predictionin a direction from a right upper side to a left lower side by applyingcuv=0.1, cw₀=1.0, cw₁=1.2, cw₂=1.4, and cw₃=1.6 to a current blockhaving a 4×4 size.

FIG. 28 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 27 , of a position of a reference pixel used by aprediction pixel within a current block.

FIG. 29 is a view showing an embodiment of performing curved predictionin a direction from a left upper side to a tight lower side (type-1) byapplying cuv=0.1, cw₀=0.0, cw₁=1.2, cw₂=1.4, and cw₃=1.6 to a currentblock having a 4×4 size.

FIG. 30 is a view showing an embodiment, as a result of applying coy andcw_(i) of FIG. 29 , of a position of a reference pixel used by aprediction pixel within a current block.

FIG. 31 is a view showing an embodiment of performing curved predictionin a direction from a left lower side to a tight upper side by applyingcuv=0.1, cw₀=1.0, cw₁=0.2, cw₂=1.4, and cw₃=1.6 to a current blockhaving a 4×4 size.

FIG. 32 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 31 , of a position of a reference pixel used by aprediction pixel within a current block.

FIG. 33 is a view showing an embodiment of performing curved predictionin a direction from a left upper side to a right lower side (type-2) byapplying cuv=0.1, cw₀=1.0, cw₁=1.2, cw₂===1.4, and cw₃=1.6 to a currentblock having a 4×4 size.

FIG. 34 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 33 , of a position of a reference pixel used by aprediction pixel within the current block.

FIG. 35 is a view showing an embodiment of performing curved predictionin a direction from an upper side to a left lower side by applyingcuv=0.6, cw₀=1.0, cw₁=0.4, cw₂=1.8, and cw₃=2.2 to a current blockhaving a 4×4 size.

FIG. 36 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 35 , of a position of a reference pixel used by aprediction pixel within the current block.

FIG. 37 is a view showing an embodiment of performing curved predictionin a direction from an upper side to a right lower side by applyingcuv=0.6, cw₀=1.0, cw₁=1.4, cw₂=1.8, and cw₃=2.2 to a current blockhaving a 4×4 size.

FIG. 38 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 37 , of a position of a reference pixel used by aprediction pixel within the current block.

FIG. 39 is a view showing an embodiment of performing curved predictionin a direction from a left side to a right upper side by applyingcuv=0.6 cw₀=1.0, cw₁=1.4, cw₂=1.8, and cw₃=2.2 to a current block havinga 4×4 size.

FIG. 40 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 39 , of a position of a reference pixel used by aprediction pixel within the current block.

FIG. 41 is a view showing an embodiment of performing curved predictionin a direction from a left side to a right lower side by applyingcuv=0.6, cw₀=1.0, cw₁=1.4, cw₂=1.8, and cw₃=2.2 to a current blockhaving a 4×4 size.

FIG. 42 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 41, of a position of a reference pixel used by aprediction pixel within the current block.

FIG. 43 is a view showing another embodiment of curved intra prediction.

FIG. 44 is a view showing an embodiment of a syntax structure of abitstream including information on intra prediction according to thepresent disclosure.

FIG. 45 is a view exemplary showing two blocks B_(a) and B_(b) adjacentto a current block B and which have been already encoded/decoded.

FIG. 46 is a view showing encoding/decoding of an intra prediction modeof a current block of a chroma component.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, althoughthe exemplary embodiments can be construed as including allmodifications, equivalents, or substitutes in a technical concept and atechnical scope of the present invention. The similar reference numeralsrefer to the same or similar functions in various aspects. In thedrawings, the shapes and dimensions of elements may be exaggerated forclarity. In the following detailed description of the present invention,references are made to the accompanying drawings that show, by way ofillustration, specific embodiments in which the invention may bepracticed. These embodiments are described in sufficient detail toenable those skilled in the art to implement the present disclosure. Itshould be understood that various embodiments of the present disclosure,although different, are not necessarily mutually exclusive. For example,specific features, structures, and characteristics described herein, inconnection with one embodiment, may be implemented within otherembodiments without departing from the spirit and scope of the presentdisclosure. In addition, it should be understood that the location orarrangement of individual elements within each disclosed embodiment maybe modified without departing from the spirit and scope of the presentdisclosure. The following detailed description is, therefore, not to betaken in a limiting sense, and the scope of the present disclosure isdefined only by the appended claims, appropriately interpreted, alongwith the full range of equivalents to what the claims claim.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without departing from the scope ofthe present invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to representcharacteristic functions different from each other. Thus, it does notmean that each constitutional part is constituted in a constitutionalunit of separated hardware or software. In other words, eachconstitutional part includes each of enumerated constitutional parts forconvenience. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded. In other words, when a specific element is referred to as being“included”, elements other than the corresponding element are notexcluded, but additional elements may be included in embodiments of thepresent invention or the scope of the present invention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. In describingexemplary embodiments of the present invention, well-known functions orconstructions will not be described in detail since they mayunnecessarily obscure the understanding of the present invention. Thesame constituent elements in the drawings are denoted by the samereference numerals, and a repeated description of the same elements willbe omitted.

In addition, hereinafter, an image may mean a picture configuring avideo, or may mean the video itself. For example, “encoding or decodingor both of an image” may mean “encoding or decoding or both of a video”,and may mean “encoding or decoding or both of one image among images ofa video.” Here, a picture and the image may have the same meaning.

Term Description

Encoder: may mean an apparatus performing encoding.

Decoder: may mean an apparatus performing decoding.

Parsing: may mean determination of a value of a syntax element byperforming entropy decoding, or may mean the entropy decoding itself.

Block: may mean a sample of an M×N matrix. Here, M and N are positiveintegers, and the block may mean a sample matrix in a two-dimensionalform.

Sample: is a basic unit of a block, and may indicate a value ranging Uto 2 Bd−1 depending on the bit depth (Bd). The sample may mean a pixelin the present invention.

Unit: may mean a unit of encoding and decoding of an image. In encodingand decoding an image, the unit may be an area generated by partitioningone image. In addition, the unit may mean a subdivided unit when oneimage is partitioned into subdivided units during encoding or decoding.In encoding and decoding an image, a predetermined process for each unitmay be performed. One unit may be partitioned into sub units that havesizes smaller than the size of the unit. Depending on functions, theunit may mean a block, a macroblock, a coding tree unit, a coding treeblock, a coding unit, a coding block, a prediction unit, a predictionblock, a transform unit, a transform block, etc. In addition, in orderto distinguish a unit from a block, the unit may, include a lumacomponent block, a chroma component block of the luma component block,and a syntax element of each color component block. The unit may havevarious sizes and shapes, and particularly, the shape of the unit may bea two-dimensional geometrical figure such as a rectangular shape, asquare shape, a trapezoid shape, a triangular shape, a pentagonal shape,etc. In addition, unit information may include at least one of a unittype indicating the coding unit, the prediction unit, the transformunit, etc., and a unit size, a unit depth, a sequence of encoding anddecoding of a unit, etc.

Reconstructed Neighbor Unit: may mean a reconstructed unit that ispreviously spatially/temporally encoded or decoded, and thereconstructed unit is adjacent to an encoding/decoding target unit.Here, a reconstructed neighbor unit may mean a reconstructed neighborblock.

Neighbor Block: may mean a block adjacent to an encoding/decoding targetblock. The block adjacent to the encoding/decoding target block may meana block having a boundary being in contact with the encoding/decodingtarget block. The neighbor block may mean a block located at an adjacentvertex of the encoding/decoding target block. The neighbor block maymean a reconstructed neighbor block.

Unit. Depth: may mean a partitioned degree of a unit. In a treestructure, a root node may be the highest node, and a leaf node may bethe lowest node.

Symbol: may mean a syntax element of the encoding/decoding target unit,a coding parameter, a value of a transform coefficient, etc.

Parameter Set: may mean header information in a structure of thebitstream. The parameter set may include at least one of a videoparameter set, a sequence parameter set, a picture parameter set, or anadaptation parameter set. In addition, the parameter set may mean sliceheader information and tile header information, etc.

Bitstream: may mean a bit string including encoded image information.

Prediction Unit: may mean a basic unit when performing inter predictionor intra prediction, and compensation for the prediction. One predictionunit may be partitioned into a plurality of partitions. In this case,each of the plurality of partitions may be a basic unit while performingthe predictions and the compensation, and each partition partitionedfrom the prediction unit may be a prediction unit. In addition, oneprediction unit may be partitioned into a plurality of small predictionunits. A prediction unit may have various sizes and shapes, andparticularly, the shape of the prediction unit may be a two-dimensionalgeometrical figure such as a rectangular shape, a square shape, atrapezoid shape, a triangular shape, a pentagonal shape, etc.

Prediction Unit Partition: may mean the shape of a partitionedprediction unit.

Reference Picture List: may mean a list including at least one referencepicture that is used for inter prediction or motion compensation. Typesof the reference picture list may be List Combined (LC), List 0 (L0),List 1 (L1), List 2 (L2), List 3 (L3), etc. At least one referencepicture list may be used for inter prediction.

Inter-Prediction Indicator: may mean one of the inter-predictiondirection (one-way directional prediction, bidirectional prediction,etc.) of an encoding/decoding target block in a case of interprediction, the number of reference pictures used for generating aprediction block by the encoding/decoding target block, and the numberof reference blocks used for performing inter prediction or motioncompensation by the encoding/decoding target block.

Reference Picture Index: may mean an index of a specific referencepicture in the reference picture list.

Reference Picture: may mean a picture to which a specific unit refersfor inter prediction or motion compensation. A reference image may bereferred to as the reference picture.

Motion Vector: is a two-dimensional vector used for inter prediction ormotion compensation, and may mean an offset between an encoding/decodingtarget picture and the reference picture. For example, (mvX, mvY) mayindicate the motion vector, mvX may indicate a horizontal component, andmvY may indicate a vertical component.

Motion Vector Candidate: may mean a unit that becomes a predictioncandidate when predicting the motion vector, or may mean a motion vectorof the unit.

Motion Vector Candidate List: may mean a list configured by using themotion vector candidate.

Motion Vector Candidate Index: may mean an indicator that indicates themotion vector candidate in the motion vector candidate list. The motionvector candidate index may be referred to as an index of a motion vectorpredictor.

Motion Information: may mean the motion vector, the reference pictureindex, and inter-prediction indicator as well as information includingat least one of reference picture list information, the referencepicture, the motion vector candidate, the motion vector candidate index,etc.

Merge Candidate List: may mean a list configured by using the mergecandidate.

Merge Candidate: may include a spatial merge candidate, a temporal mergecandidate, a combined merge candidate, a combined bi-prediction mergecandidate, a zero merge candidate, etc.

The merge candidate may include motion information such as predictiontype information, a reference picture index for each list, a motionvector, etc.

Merge Index: may mean information indicating the merge candidate in themerge candidate list. In addition, the merge index may indicate a block,which derives the merge candidate, among reconstructed blocksspatially/temporally adjacent to the current block. In addition, timemerge index may indicate at least one of pieces of motion information ofthe merge candidate.

Transform Unit: may mean a basic unit when performing encoding/decodingof a residual signal, similar to transform, inverse transform,quantization, dequantization, and transform coefficientencoding/decoding. One transform unit may be partitioned into aplurality of small transform units. The transform unit may have varioussixes and shapes. Particularly, the shape of the transform unit may be atwo-dimensional geometrical figure such as a rectangular shape, a squareshape, a trapezoid shape, a triangular shape, a pentagonal shape, etc.

Scaling: may mean a process of multiplying a factor to a transformcoefficient level, and as a result, a transform coefficient may begenerated. The scaling may be also referred to as dequantization.

Quantization Parameter: may mean a value used in scaling the transformcoefficient level during quantization and dequantization. Here, thequantization parameter may be a value mapped to a step size of thequantization.

Delta Quantization Parameter: may mean a difference value between apredicted quantization parameter and a quantization parameter of theencoding/decoding target unit.

Scan: may mean a method of sorting coefficient orders within a block ora matrix. For example, sorting a two-dimensional matrix into aone-dimensional matrix may be referred to as scanning, and sorting aone-dimensional matrix into a two-dimensional matrix may be referred toas scanning or inverse scanning.

Transform Coefficient: may mean a coefficient value generated afterperforming a transform. In the present invention, a quantized transformcoefficient level that is a transform coefficient to which thequantization is applied may be referred to as the transform coefficient.

Non-zero Transform Coefficient: may mean a transform coefficient inwhich a value thereof is not 0, or may mean a transform coefficientlevel in which a value thereof is not 0.

Quantization Matrix: may mean a matrix used in quantization anddequantization in order to enhance subject quality or object quality ofan image. The quantization matrix may be referred to as a scaling list.

Quantization Matrix Coefficient: may mean each element of a quantizationmatrix. The quantization matrix coefficient may be referred to as amatrix coefficient.

Default Matrix: may mean a predetermined quantization matrix that isdefined in the encoder and the decoder in advance.

Non-default Matrix: may mean a quantization matrix that is signaled by auser without being previously defined in the encoder and the decoder.

Coding Tree Unit: may be composed of one lama component (Y) coding treeunit and related two chroma components (Cb, Cr) coding tree units. Eachcoding tree unit may be partitioned by using at least one partitionmethod such as a quad tree, a binary tree, etc. to configure sub unitssuch as coding units, prediction units, transform units, etc. The codingtree unit may be used as a term for indicating a pixel block that is aprocessing unit in decoding/encoding process of an image, like partitionof an input image.

Coding Tree Block: may be used as a term for indicating one of the Ycoding tree unit, the Cb coding tree unit, and the Cr coding tree unit.

FIG. 1 is a block diagram showing configurations of an encodingapparatus according to an embodiment of the present invention.

The encoding apparatus 100 may be a video encoding apparatus or an imageencoding apparatus. A video may include one or more images. The encodingapparatus 100 may encode the one or more images of the video in order oftime.

Referring to FIG. 1 , the encoding apparatus 100 may include a motionprediction unit 111, a motion compensation unit 112, an intra-predictionunit 120, a switch 115, a subtractor 125, a transform unit 130, aquantization unit 140, an entropy encoding unit 150, a dequantizationunit 160, an inverse transform unit 170, an adder 175, a filter unit180, and a reference picture buffer 190.

The encoding apparatus 100 may encode an input picture in an intra modeor an inter mode or both. In addition, the encoding apparatus 100 maygenerate a bitstream by encoding the input picture, and may output thegenerated bitstream. When the intra mode is used as a prediction mode,the switch 115 may be switched to intra. When the inter mode is used asa prediction mode, the switch 115 may be switched to inter. Here, theintra mode may be referred to as an intra-prediction mode, and the intermode may be referred to as an inter-prediction mode. The encodingapparatus 100 may generate a prediction block of an input block of theinput picture. In addition, after generating the prediction block, theencoding apparatus 100 may encode residuals between the input block andthe prediction block. The input picture may be referred to as a currentimage that is a target of current encoding. The input block may bereferred to as a current block or as an encoding target block that is atarget of the current encoding.

When the prediction mode is the intra mode, the intra-prediction unit120 may use a pixel value of a previously encoded block, which isadjacent to the current block, as a reference pixel. Theintra-prediction unit 120 may perform spatial prediction by using thereference pixel, and may generate prediction samples of the input blockby using the spatial prediction. Here, intra prediction may meanintra-frame prediction.

When the prediction mode is the inter mode, the motion prediction unit111 may search for a region that is optimally matched with the inputblock from a reference picture in a motion predicting process, and mayderive a motion vector by using the searched region. The referencepicture may be stored in the reference picture buffer 190.

The motion compensation unit 112 may generate the prediction block byperforming motion compensation using the motion vector. Here, the motionvector may be a two-dimensional vector that is used for interprediction. In addition, the motion vector may indicate offset betweenthe current picture and the reference picture. Here, inter predictionmay be mean inter-frame prediction.

When a value of the motion vector is not an integer, the motionprediction unit 111 and the motion compensation unit 112 may generatethe prediction block by applying an interpolation filter to a partialregion in the reference picture. In order to perform inter prediction ormotion compensation, on the basis of the coding unit, it is possible todetermine which methods the motion prediction and compensation methodsof a prediction unit in the coding unit uses among the skip mode, themerge mode, the AMVP mode, and a current picture reference mode. Interprediction or motion compensation may be performed according to eachmode. Here, the current picture reference mode may mean a predictionmode using a pre-reconstructed region of a current picture having anencoding target block. In order to specify the pre-reconstructed region,a motion vector for the current picture reference mode may be defined.Whether the encoding target block is encoded in the current picturereference mode may be encoded by using a reference picture index of theencoding target block.

The subtractor 125 may generate a residual block by using the residualsbetween the input block and the prediction block. The residual block maybe referred to as a residual signal.

The transform unit 130 may generate a transform coefficient bytransforming the residual block, and may output the transformcoefficient. Here, the transform coefficient may be a coefficient valuegenerated by transforming the residual block. In a transform skip mode,the transform unit 130 may skip the transforming of the residual block.

A quantized transform coefficient level may be generated by applyingquantization to the transform coefficient. Hereinafter, the quantizedtransform coefficient level may be referred to as the transformcoefficient in the embodiment of the present invention.

The quantization unit 140 may generate the quantized transformcoefficient level by, quantizing the transform coefficient depending onthe quantization parameter, and may output the quantized transformcoefficient level. Here, the quantization unit 140 may quantize thetransform coefficient by using a quantization matrix.

The entropy encoding unit 150 may generate the bitstream by performingentropy encoding according to the probability distribution, on valuescalculated by the quantization unit 140 or on coding parameter valuescalculated in an encoding process, etc., and may output the generatedbitstream. The entropy encoding unit 150 may perform the entropyencoding on information for decoding an image, and on information of apixel of an image. For example, the information for decoding an imagemay include a syntax element, etc.

When the entropy encoding is applied, symbols are represented byallocating a small number of bits to the symbols having high occurrenceprobability and allocating a large number of bits to the symbols havinglow occurrence probability, thereby reducing the size of the bitstreamof encoding target symbols. Therefore, compression efficiency of theimage encoding may be increased through the entropy encoding. For theentropy encoding, the entropy encoding unit 150 may use an encodingmethod such as exponential Golomb, context-adaptive variable lengthcoding (CAVLC), and context-adaptive binary arithmetic coding (CABAC).For example, the entropy encoding unit 150 may perform the entropyencoding by using a variable length coding/code (\TLC) table. Inaddition, the entropy encoding unit 150 may derive a binarization methodof the target symbol and a probability model of the target symbol/bin,and may perform arithmetic coding by using the derived binarizationmethod or the derived probability model thereafter.

In order to encode the transform coefficient level, the entropy encodingunit 150 may, change a two-dimensional block form coefficient into aone-dimensional vector form by using a transform coefficient scanningmethod. For example, the two-dimensional form coefficient may be changedinto the one-dimensional vector form by scanning the coefficient of theblock with up-right scanning. According to the size of the transformunit and the intra-prediction mode, instead of the up-right scanning, itis possible to use vertical direction scanning for scanning thetwo-dimensional block form coefficient in a column direction, andhorizontal direction scanning for scanning the two-dimensional blockform coefficient in a row direction. That is, it is possible todetermine which scanning method among up-right scanning, verticaldirection scanning, and horizontal direction scanning is to be useddepending on the size of the transform unit and the intra-predictionmode.

The coding parameter may include information, such as the syntaxelement, which is encoded by the encoder and is signaled to the decoder,and may include information that may be derived in the encoding ordecoding process. The coding parameter may mean information that isnecessary to encode or decode an image. For example, the codingparameter may include at least one value or combined form of the blocksize, the block depth, the block partition information, the unit size,the unit depth, the unit partition information, the partition flag of aquad-tree form, the partition flag of a binary-tree form, the partitiondirection of a binary-tree form, the intra-prediction mode, theintra-prediction direction, the reference sample filtering method, theprediction block boundary filtering method, the filter tap, the filtercoefficient, the inter-prediction mode, the motion information, themotion vector, the reference picture index, the inter-predictiondirection, the inter-prediction indicator, the reference picture list,the motion vector predictor, the motion vector candidate list, theinformation about whether or not the motion merge mode is used, themotion merge candidate, motion merge candidate list, the informationabout whether or not the skip mode is used, interpolation filter type,the motion vector size, accuracy of motion vector representation, thetransform type, the transform size, the information about whetheradditional (secondary) transform is used, the information about whetheror not a residual signal is present, the coded block pattern, the codedblock flag, the quantization parameter, the quantization matrix, thefilter information within a loop, the information about whether or not afilter is applied within a loop, the filter coefficient within a loop,binarization/inverse binarization method, the context model, the contextbin, the bypass bin, the transform coefficient, transform coefficientlevel, transform coefficient level scanning method, the imagedisplay/output order, slice identification information, slice type,slice partition information, tile identification information, tile type,tile partition information, the picture type, bit depth, and theinformation of a luma signal or a chroma signal.

The residual signal may mean the difference between the original signaland the prediction signal. Alternatively, the residual signal may be asignal generated by transforming the difference between the originalsignal and the prediction signal. Alternatively, the residual signal maybe a signal generated by transforming and quantizing the differencebetween the original signal and the prediction signal. The residualblock may be the residual signal of a block unit.

When the encoding apparatus 100 performs encoding by using interprediction, the encoded current picture may be used as a referencepicture for another image(s) that will be processed thereafter.Accordingly, the encoding apparatus 100 may decode the encoded currentpicture, and may store the decoded image as the reference picture. Inorder to perform the decoding, dequantization and inverse transform maybe performed on the encoded current picture.

A quantized coefficient may be dequantized by the dequantization unit160, and may be inversely transformed by the inverse transform unit 170.The dequantized and inversely transformed coefficient may be added tothe prediction block by the adder 175, whereby a reconstructed block maybe generated.

The reconstructed block may pass the filter unit 180. The filter unit180 may apply at least one of a deblocking filter, a sample adaptiveoffset (SAO), and an adaptive loop filter (ALF) to the reconstructedblock or a reconstructed picture. The filter unit 180 may be referred toas an in-loop filter.

The deblocking filter may remove block distortion that occurs atboundaries between the blocks. In order to determine whether or not thedeblocking filter is operated, it is possible to determine whether ornot the deblocking filter is applied to the current block on the basisof the pixels included in several rows or columns in the block. When thedeblocking filter is applied to the block, a strong filter or a weakfilter may be applied depending on required deblocking filteringstrength. In addition, in applying the deblocking filter, horizontaldirection filtering and vertical direction filtering may be processed inparallel.

The sample adaptive offset may add an optimum offset value to the pixelvalue in order to compensate for an encoding error. The sample adaptiveoffset may correct an offset between the deblocking filtered image andthe original picture for each pixel. In order to perform the offsetcorrection on a specific picture, it is possible to use a method ofapplying an offset in consideration of edge information of each pixel ora method of partitioning pixels of an image into the predeterminednumber of regions, determining a region to be subjected to perform anoffset correction, and applying the offset correction to the determinedregion.

The adaptive loop filter may perform filtering on the basis of a valueobtained by comparing the reconstructed picture and the originalpicture. Pixels of an image may be partitioned into predeterminedgroups, one filter being applied to each of the groups is determined,and different filtering may be performed at each of the groups.Information about whether or not the adaptive loop filter is applied tothe lima signal may be signaled for each coding unit (CU). A shape and afilter coefficient of an adaptive loop filter being applied to eachblock may vary. In addition, an adaptive loop filter having the sameform (fixed form) may be applied regardless of characteristics of atarget block.

The reconstructed block that passed the filter unit 180 may be stored inthe reference picture buffer 190.

FIG. 2 is a block diagram showing configurations of a decoding apparatusaccording to an embodiment of the present invention.

The decoding apparatus 200 may be a video decoding apparatus or an imagedecoding apparatus.

Referring to FIG. 2 , the decoding apparatus 200 may include an entropydecoding unit 210, a dequantization unit 220, an inverse transform unit230, an intra-prediction unit 240, a motion compensation unit 250, anadder 255, a filter unit 260, and a reference picture buffer 270.

The decoding apparatus 200 may receive the bitstream outputted from theencoding apparatus 100. The decoding apparatus 200 may decode thebitstream in the intra mode or the inter mode. In addition, the decodingapparatus 200 may generate a reconstructed picture by performingdecoding, and may output the reconstructed picture.

When a prediction mode used in decoding is the intra mode, the switchmay be switched to intra. When the prediction mode used in decoding isthe inter mode, the switch may be switched to inter.

The decoding apparatus 200 may obtain the reconstructed residual blockfrom the inputted bitstream, and may generate the prediction block. Whenthe reconstructed residual block and the prediction block are obtained,the decoding apparatus 200 may generate the reconstructed block, whichis a decoding target block, by adding the reconstructed residual blockand the prediction block. The decoding target block may be referred toas a current block.

The entropy decoding unit 210 may generate symbols by performing entropydecoding on the bitstream according to the probability distribution. Thegenerated symbols may include a symbol having a quantized transformcoefficient level. Here, a method of entropy decoding may be similar tothe above-described method of the entropy encoding. For example, themethod of the entropy decoding may be an inverse process of theabove-described method of the entropy encoding.

In order to decode the transform coefficient level, the entropy decodingunit 210 may perform transform coefficient scanning, whereby theone-dimensional vector form coefficient can be changed into thetwo-dimensional block form. For example, the one-dimensional vector formcoefficient may be changed into a two-dimensional block form by scanningthe coefficient of the block with up-right scanning. According to thesize of the transform unit and the intra-prediction mode, instead ofup-right scanning, it is possible to use vertical direction scanning andhorizontal direction scanning. That is, it is possible to determinewhich scanning method among up-right scanning, vertical directionscanning, and horizontal direction scanning is used depending on thesize of the transform unit and the intra-prediction mode.

The quantized transform coefficient level may be dequantized by thedequantization unit 220, and may be inversely transformed by the inversetransform unit 230. The quantized transform coefficient level isdequantized and is inversely transformed so as to generate areconstructed residual block. Here, the dequantization unit 220 mayapply the quantization matrix to the quantized transform coefficientlevel.

When the intra mode is used, the intra-prediction unit 240 may generatea prediction block by performing the spatial prediction that uses thepixel value of the previously decoded block that is adjacent to thedecoding target block.

When the inter mode is used, the motion compensation unit 250 maygenerate the prediction block by performing motion compensation thatuses both the motion vector and the reference picture stored in thereference picture buffer 270. When the value of the motion vector is notan integer, the motion compensation unit 250 may generate the predictionblock by applying the interpolation filter to the partial region in thereference picture. In order to perform motion compensation, on the basisof the coding unit, it is possible to determine which method the motioncompensation method of a prediction unit in the coding unit uses amongthe skip mode, the merge mode, the AMVP mode, and a current picturereference mode. In addition, it is possible to perform motioncompensation depending on the modes. Here, the current picture referencemode may mean a prediction mode using a previously reconstructed regionwithin the current picture having the decoding target block. Thepreviously reconstructed region may not be adjacent to the decodingtarget block. In order to specify the previously reconstructed region, afixed vector may be used for the current picture reference mode. Inaddition, a flag or an index indicating whether or not the decodingtarget block is a block decoded in the current picture reference modemay be signaled, and may be derived by using the reference picture indexof the decoding target block. The current picture for the currentpicture reference mode may exist at a fixed position (for example, aposition of a reference picture index is 0 or the last position) withinthe reference picture list for the decoding target block. In addition,it is possible for the current picture to be variably positioned withinthe reference picture list, and to this end, it is possible to signalthe reference picture index indicating a position of the currentpicture. Here, signaling a flag or an index may mean entropy encodingthe corresponding flag or index and including it into a bitstream at anencoder, and may mean entropy decoding the corresponding flag or indexfrom a bitstream at a decoder.

The reconstructed residual block may be added to the prediction block bythe adder 255. A block generated by adding the reconstructed residualblock and the prediction block may pass the filter unit 260. The filterunit 260 may apply at least one of the deblocking filter, the sampleadaptive offset, and the adaptive loop filter to the reconstructed blockor to the reconstructed picture. The filter unit 260 may output thereconstructed picture. The reconstructed picture may be stored in thereference picture buffer 270, and may be used for inter prediction.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image. FIG. 3 schematically shows anembodiment of partitioning one unit into a plurality of sub-units.

In order to efficiently partition an image, a coding unit (CU) may beused in encoding and decoding. Here, the coding unit may mean anencoding unit. The unit may be a combination of 1) a syntax element and2) a block including image samples. For example, “partition of a unit”may mean “partition of a block relative to a unit”. The block partitioninformation may include information about the unit depth. Depthinformation may indicate the number of times a unit is partitioned or apartitioned degree of a unit or both.

Referring to FIG. 3 , an image 300 is sequentially partitioned for eachlargest coding unit (LCU), and a partition structure is determined foreach LCU. Here, the LCU and a coding tree unit (CTU) have the samemeaning. One unit may have depth information based on a tree structure,and may be hierarchically partitioned. Each of the partitioned sub-unitsmay have depth information. The depth information indicates the numberof times a unit is partitioned or a partitioned degree of a unit orboth, and thus, the depth information may include information about thesize of the sub-unit.

The partition structure may mean distribution of a coding unit (CU) inthe LCU 310. The CU may be a unit for efficiently encoding/decoding animage. The distribution may be determined on the basis of whether or notone CU will be partitioned in plural (a positive integer equal to ormore than 2 including 2, 4, 8, 16, etc.). The width size and the heightsize of the partitioned CU may respectively be a half width size and ahalf height size of the original CU. Alternatively, according to thenumber of partitionings, the width size and the height size of thepartitioned CU may respectively be smaller than the width size and theheight size of the original CU. The partitioned CU may be recursivelypartitioned into a plurality of further partitioned CUs, wherein thefurther partitioned CU has a width size and a height size smaller thanthose of the partitioned CU in the same partition method.

Here, the partition of a CU may be recursively performed up to apredetermined depth. Depth information may be information indicating asize of the CU, and may be stored in each CU. For example, the depth ofthe LCU may be 0, and the depth of a smallest coding unit (SCU) may be apredetermined maximum depth. Here, the LCU may be a coding unit having amaximum size as described above, and the SCU may be a coding unit havinga minimum size.

Whenever the LCU 310 begins to be partitioned, and the width size andthe height size of the CU are decreased by the partitioning, the depthof a CU is increased by 1. In a case of a CU which cannot bepartitioned, the CU may have a 2N×2N size for each depth. In a case of aCU that can be partitioned, the CU having a 2N×2N size may bepartitioned into a plurality of N×N-size CUs. The size of N is reducedby half whenever the depth is increased by 1.

For example, when one coding unit is partitioned into four sub-codingunits, a width size and a height size of one of the four sub-codingunits may respectively be a half width size and a half height size ofthe original coding unit. For example, when a 32×32-size coding unit ispartitioned into four sub-coding units, each of the four sub-codingunits may have a 16×16 size. When one coding unit is partitioned intofour sub-coding units, the coding unit may be partitioned in a quad-treeform.

For example, when one coding unit is partitioned into two sub-codingunits, a width size or a height size of one of the two sub-coding unitsmay respectively be a half width size or a half height size of theoriginal coding unit. For example, when a 32×32-size coding unit isvertically partitioned into two sub-coding units, each of the twosub-coding units may have a 16×32 size. For example, when a 32×32-sizecoding unit is horizontally partitioned into two sub-coding units, eachof the two sub-coding units may have a 32×16 size. When one coding unitis partitioned into two sub-coding units, the coding unit may bepartitioned in a binary-tree form.

Referring to FIG. 3 , the size of the LCU having a minimum depth of 0may be 64×64 pixels, and the size of the SCU having a maximum depth of 3may be 8×8 pixels. Here, a CU having 64×64 pixels, which is the LCU, maybe denoted by a depth of 0, a CU having 32×32 pixels may be denoted by adepth of 1, a CU having 16×16 pixels may be denoted by a depth of 2, anda CU having 8×8 pixels, which is the SCU, may be denoted by a depth of3.

In addition, information about whether or not a CU will be partitionedmay be represented through partition information of a CU. The partitioninformation may be 1 bit information. The partition information may beincluded in all CUs other than the SCU. For example, when a value of thepartition information is 0, a CU may not be partitioned, and when avalue of the partition information is 1, a CU may be partitioned.

FIG. 4 is a view showing forms of a prediction unit (PU) that may beincluded in a coding unit (CU).

A CU that is no longer partitioned, from among CUs partitioned from theLCU, may be partitioned into at least one prediction unit (PU). Thisprocess may be also referred to as a partition.

The PU may be a basic unit for prediction. The PU may be encoded anddecoded in any one of a skip mode, an inter mode, and an intra mode. ThePU may be partitioned in various forms depending on the modes.

In addition, the coding unit may not be partitioned into a plurality ofprediction units, and the coding unit and the prediction unit have thesame size.

As shown in FIG. 4 , in the skip mode, the CU may not be partitioned. Inthe skip mode, a 2N×2N mode 410 having the same size as a CU withoutpartition may be supported.

In the inter mode, 8 partitioned forms may be supported within a CU. Forexample, in the inter mode, the 2N×2N mode 410, a 2N×N mode 415, an N×2Nmode 420, an N>N mode 425, a 2N×nU mode 430, a 2N×nD mode 435, an nL×2Nmode 440, and an nR×2N mode 445 may be supported. In the intra mode, the2N×2N mode 410 and the N×N mode 425 may be supported.

One coding unit may be partitioned into one or more prediction units.One prediction unit may be partitioned into one or more sub-predictionunits.

For example, when one prediction unit is partitioned into foursub-prediction units, a width size and a height size of one of the foursub-prediction units may be a half width size and a half height size ofthe original prediction unit. For example, when a 32×32-size predictionunit is partitioned into four sub-prediction units, each of the foursub-prediction units may have a 16×16 size. When one prediction unit ispartitioned into four sub-prediction units, the prediction unit may bepartitioned in the quad-tree form.

For example, when one prediction unit is partitioned into twosub-prediction units, a width size or a height size of one of the twosub-prediction units may be a half width size or a half height size ofthe original prediction unit. For example, when a 32×32-size predictionunit is vertically partitioned into two sub-prediction units, each ofthe two sub-prediction units may have a 16×32 size. For example, when a32×32-size prediction unit is horizontally partitioned into twosub-prediction units, each of the two sub-prediction units may have a32×16 size. When one prediction unit is partitioned into twosub-prediction units, the prediction unit may be partitioned in thebinary-tree form.

FIG. 5 is a view showing forms of a transform unit (TU) that may beincluded in a coding unit (CU).

A transform unit (TU) may be a basic unit used for a transform,quantization, a reverse transform, and dequantization within a CU. TheTU may have a square shape or a rectangular shape, etc. The TU may bedependently determined by a size of a CU or a form of a CU or both.

A CU that is no longer partitioned among CUs partitioned from the LCUmay be partitioned into at least one TU. Here, the partition structureof the TU may be a quad-tree structure. For example, as shown in FIG. 5, one CU 510 may be partitioned once or more depending on the quad-treestructure. The case where one CU is partitioned at least once may bereferred to as recursive partition, Through the partitioning, one CU 510may be formed of TUs having various sizes. Alternatively, a CU may bepartitioned into at least one TU depending on the number of verticallines partitioning the CU or the number of horizontal lines partitioningthe CU or both. The CU may be partitioned into TUs that are symmetricalto each other, or may be partitioned into TUs that are asymmetrical toeach other. In order to partition the CU into TUs that are symmetricalto each other, information of a size/shape of the TU may be signaled,and may be derived from information of a size/shape of the CU.

In addition, the coding unit may not be partitioned into transformunits, and the coding unit and the transform unit may have the samesize.

One coding unit may be partitioned into at least one transform unit, andone transform unit may be partitioned into at least one sub-transformunit.

For example, when one transform unit is partitioned into foursub-transform units, a width size and a height size of one of the foursub-transform units may respectively be a half width size and a halfheight size of the original transform unit. For example, when a32×32-size transform unit is partitioned into four sub-transform units,each of the four sub-transform units may have a 16×16 size. When onetransform unit is partitioned into four sub-transform units, thetransform unit may be partitioned in the quad-tree form.

For example, when one transform unit is partitioned into twosub-transform units, a width size or a height size of one of the twosub-transform units may respectively be a half width size or a halfheight size of the original transform unit. For example, when a32×32-size transform unit is vertically partitioned into twosub-transform units, each of the two sub-transform units may have a16×32 size. For example, when a 32×32-size transform unit ishorizontally partitioned into two sub-transform units, each of the twosub-transform units may have a 32×16 size. When one transform unit ispartitioned into two sub-transform units, the transform unit may bepartitioned in the binary-tree form.

When performing transform, the residual block may be transformed byusing at least one of predetermined transform methods. For example, thepredetermined transform methods may include discrete cosine transform(DCT), discrete sine transform (DST), KLT, etc. Which transform methodis applied to transform the residual block may be determined by using atleast one of inter-prediction mode information of the prediction unit,intra-prediction mode information of the prediction unit, and size/shapeof the transform block. Information indicating the transform method maybe signaled.

FIG. 6 is a view for explaining an embodiment of a process of intraprediction.

The intra-prediction mode may be a non-directional mode or a directionalmode. The non-directional mode may be a DC mode or a planar mode. Thedirectional mode may be a prediction mode having a particular directionor angle, and the number of directional modes may be M which is equal toor greater than one. The directional mode may be indicated as at leastone of a mode number, a mode value, and a mode angle.

The number of intra-prediction modes may be N which is equal to orgreater than one, including the non-directional and directional modes.

The number of intra-prediction modes may vary depending on the size of ablock. For example, when the size is 4×4 or 8×8, the number may be 67,and when the size is 16×16, the number may be 35, and when the size is32×32, the number may be 19, and when the size is 64×64, the number maybe 7.

The number of intra-prediction modes may be fixed to N regardless of thesize of a block. For example, the number may be fixed to at least one of35 or 67 regardless of the size of a block.

The number of intra-prediction modes may vary depending on a type of acolor component. For example, the number of prediction modes may varydepending on Whether a color component is a luma signal or a chromasignal.

Intra encoding and/or decoding may be performed by using a sample valueor an encoding parameter included in a reconstructed neighboring block.

For encoding/decoding a current block in intra prediction, whether ornot samples included in a reconstructed neighboring block are availableas reference samples of an encoding/decoding target block may beidentified. When there are samples that cannot be used as referencesamples of the encoding/decoding target block, sample values are copiedand/or interpolated into the samples that cannot be used as thereference samples by using at least one of samples included in thereconstructed neighboring block, whereby the samples that cannot be usedas reference samples can be used as the reference samples of theencoding/decoding target block.

In intra prediction, based on at least one of an intra-prediction modeand the size of the encoding/decoding target block, a filter may beapplied to at least one of a reference sample or a prediction sample.Here, the encoding/decoding target block may mean a current block, andmay mean at least one of a coding block, a prediction block, and atransform block. A type of a filter being applied to a reference sampleor a prediction sample may vary depending on at least one of theintra-prediction mode or size/shape of the current block. The type ofthe filter may vary depending on at least one of the number of filtertaps, a filter coefficient value, or filter strength.

In a non-directional planar mode among intra-prediction modes, whengenerating a prediction block of the encoding/decoding, target block, asample value in the prediction block may be generated by using aweighted sum of an upper reference sample of the current sample, a leftreference sample of the current sample, an upper right reference sampleof the current block, and a lower left reference sample of the currentblock according to the sample location.

In a non-directional DC mode among intra-prediction modes, whengenerating a prediction block of the encoding/decoding target block, itmay be generated by an average value of upper reference samples of thecurrent block and left reference samples of the current block. Inaddition, filtering may be performed on one or more upper rows and oneor more left columns adjacent to the reference sample in theencoding/decoding block by using reference sample values.

In a case of multiple directional modes (angular mode) amongintra-prediction modes, a prediction block may be generated by using theupper right and/or lower left reference sample, and the directionalmodes may have different direction. In order to generate a predictionsample value, interpolation of a real number unit may be performed.

In order to perform an intra-prediction method, an intra-prediction modeof a current prediction block may be predicted from an intra-predictionmode of a neighboring prediction block that is adjacent to the currentprediction block. In a case of prediction the intra-prediction mode ofthe current prediction block by using mode information predicted fromthe neighboring intra-prediction mode, when the current prediction blockand the neighboring prediction block have the same intra-predictionmode, information that the current prediction block and the neighboringprediction block have the same intra-prediction mode may be signaled byusing predetermined flag information. When the intra-prediction mode ofthe current prediction block is different from the intra-prediction modeof the neighboring prediction block, intra-prediction mode informationof the encoding decoding target block may be encoded by performingentropy encoding.

FIG. 7 is a view for explaining an embodiment of a process of interprediction.

The quadrangular shapes shown in FIG. 7 may indicate images (or,pictures). Also, the arrows of FIG. 7 may indicate predictiondirections. That is, images may be encoded or decoded or both accordingto prediction directions. Each image may be classified into an I-picture(intra picture), a P-picture (uni-predictive picture), a B-picture(bi-predictive picture), etc. according to encoding types. Each picturemay be encoded and decoded depending on an encoding type of eachpicture.

When an image, which is an encoding target, is an I-picture, the imageitself may be intra encoded without inter prediction. When an image,which is an encoding target, is a P-picture, the image may be encoded byinter prediction or motion compensation using a reference picture onlyin a forward direction. When an image, which is an encoding target, is aB-picture, the image may be encoded by inter prediction or motioncompensation using reference pictures in both a forward direction and areverse direction. Alternatively, the image may be encoded by interprediction or motion compensation using a reference picture in one of aforward direction and a reverse direction. Here, when aninter-prediction mode is used, the encoder may perform inter predictionor motion compensation, and the decoder may perform motion compensationin response to the encoder. Images of the P-picture and the B-picturethat are encoded or decoded or both by using a reference picture may beregarded as an image for inter prediction.

Hereinafter, inter prediction according to an embodiment will bedescribed in detail.

Inter prediction or motion compensation may be performed by using both areference picture and motion information. In addition, inter predictionmay use the above described skip mode.

The reference picture may be at least one of a previous picture and asubsequent picture of a current picture. Here, inter prediction maypredict a block of the current picture depending on the referencepicture. Here, the reference picture may mean an image used inpredicting a block. Here, an area within the reference picture may bespecified by using a reference picture index (refIdx) indicating areference picture, a motion vector, etc.

Inter prediction may select a reference picture and a reference blockrelative to a current block within the reference picture. A predictionblock of the current block may be generated by using the selectedreference block. The current block may be a block that is a currentencoding or decoding target among blocks of the current picture.

Motion information may be derived from a process of inter prediction bythe encoding apparatus 100 and the decoding apparatus 200. In addition,the derived motion information may be used in performing interprediction. Here, the encoding apparatus 100 and the decoding apparatus200 may enhance encoding efficiency or decoding efficiency or both byusing motion information of a reconstructed neighboring block or motioninformation of a collocated block (col block) or both. The col block maybe a block relative to a spatial position of the encoding decodingtarget block within a collocated picture (col picture) that ispreviously, reconstructed. The reconstructed neighboring block may be ablock within a current picture, and a block that is previouslyreconstructed through encoding or decoding or both. In addition, thereconstructed block may be a block adjacent to the encoding/decodingtarget block or a block positioned at an outer corner of theencoding/decoding target block or both. Here, the block positioned atthe outer corner of the encoding/decoding target block may be a blockthat is vertically adjacent to a neighboring block horizontally adjacentto the encoding/decoding target block. Alternatively, the blockpositioned at the outer corner of the encoding/decoding target block maybe a block that is horizontally adjacent to a neighboring blockvertically adjacent to the encoding/decoding target block.

The encoding apparatus 100 and the decoding apparatus 200 mayrespectively determine a block that exists at a position spatiallyrelative to the encoding decoding target block within the col picture,and may determine a predefined relative position on the basis of thedetermined block. The predefined relative position may be an innerposition or an outer position or both of a block that exists at aposition spatially relative to the encoding/decoding target block. Inaddition, the encoding apparatus 100 and the decoding apparatus 200 mayrespectively derive the col block on the basis of the determinedpredefined relative position, Here, the col picture may be one pictureof at least one reference picture included in the reference picturelist.

A method of deriving the motion information may vary according to aprediction mode of the encoding/decoding target block. For example, aprediction mode being applied for inter prediction may include anadvanced motion vector prediction (AMVP), a merge mode, etc. Here, themerge mode may be referred to as a motion merge mode.

For example, when AMVP is applied as the prediction mode, the encodingapparatus 100 and the decoding apparatus 200 may respectively generate amotion vector candidate list by using a motion vector of thereconstructed neighboring block or a motion vector of the col block orboth. The motion vector of the reconstructed neighboring block or themotion vector of the col block or both may be used as motion vectorcandidates. Here, the motion vector of the col block may be referred toas a temporal motion vector candidate, and the motion vector of thereconstructed neighboring block may be referred to as a spatial motionvector candidate.

The encoding apparatus 100 may generate a bitstream, and the bitstreammay include a motion vector candidate index. That is, the encodingapparatus 100 may generate a bitstream by entropy encoding the motionvector candidate index. The motion vector candidate index may indicatean optimum motion vector candidate that is selected from motion vectorcandidates included in the motion vector candidate list. The motionvector candidate index may be signaled from the encoding apparatus 100to the decoding apparatus 200 through the bitstream.

The decoding apparatus 200 may entropy decode the motion vectorcandidate index from the bitstream, and may select a motion vectorcandidate of a decoding target block among the motion vector candidatesincluded in the motion vector candidate list by using the entropydecoded motion vector candidate index.

The encoding apparatus 100 may calculate a motion vector difference(MVD) between the motion vector and the motion vector candidate of thedecoding target block, and may entropy encode the MVD. The bitstream mayinclude the entropy encoded MVD. The MVD may be signaled from theencoding apparatus 100 to the decoding apparatus 200 through thebitstream. Here, the decoding apparatus 200 may entropy decode thereceived MVD from the bitstream. The decoding apparatus 200 may derive amotion vector of the decoding target block through a sum of the decodedMVD and the motion vector candidate.

The bitstream may include a reference picture index indicating areference picture, etc., and a reference picture index may be entropyencoded and signaled from the encoding apparatus 100 to the decodingapparatus 200 through the bitstream. The decoding apparatus 200 maypredict a motion vector of the decoding target block by using motioninformation of neighboring blocks, and may derive the motion vector ofthe decoding target block by using the predicted motion vector and themotion vector difference. The decoding apparatus 200 may generate theprediction block of the decoding target block on the basis of thederived motion vector and reference picture index information.

As another method of deriving the motion information, a merge mode isused. The merge mode may mean a merger of motions of a plurality ofblocks. The merge mode may mean application of motion information of oneblock to another block. When the merge mode is applied, the encodingapparatus 100 and the decoding apparatus 200 may respectively generate amerge candidate list by using motion information of the reconstructedneighboring block or motion information of the col block or both. Themotion information may include at least one of 1) the motion vector, 2)the reference picture index, and 3) the inter-prediction indicator. Aprediction indicator may indicate a uni-direction (L0 prediction, L1prediction) or a bi-direction.

Here, the merge mode may be applied to each CU or each PU. When themerge mode is performed at each CU or each PU, the encoding apparatus100 may generate a bitstream by entropy decoding predefined information,and may signal the bitstream to the decoding apparatus 200. Thebitstream may include the predefined information. The predefinedinformation may include: 1) a merge flag that is information indicatingwhether or not the merge mode is performed for each block partition; and2) a merge index that is information to which a block among theneighboring blocks adjacent to the encoding target block is merged. Forexample, neighboring blocks adjacent to the encoding target block mayinclude a left neighboring block of the encoding target block, an upperneighboring block of the encoding target block, a temporally neighboringblock of the encoding target block, etc.

The merge candidate list may indicate a list storing motion information.In addition, the merge candidate list may be generated in advance ofperforming the merge mode. The motion information stored in the mergecandidate list may be at least one of motion information of theneighboring block adjacent to the encoding/decoding target block, motioninformation of the collocated block relative to the encoding/decodingtarget block in the reference picture, motion information newlygenerated by a combination of motion information that exists in themerge motion candidate list in advance, and a zero merge candidate.Here, motion information of the neighboring block adjacent to theencoding/decoding target block may be referred to as a spatial mergecandidate. Motion information of the collocated block relative to theencoding/decoding target block in the reference picture may be referredto as a temporal merge candidate.

A skip mode may be a mode applying the mode information of theneighboring block itself to the encoding/decoding, target block. Theskip mode may be one of modes used for inter prediction. When the skipmode is used, the encoding apparatus 100 may entropy encode informationabout motion information of which block is used as motion information ofthe encoding target block, and may signal the information to thedecoding apparatus 200 through a bitstream. The encoding apparatus 100may not signal other information, for example, syntax elementinformation, to the decoding apparatus 200. The syntax elementinformation may include at least one of motion vector differenceinformation, a coded block flag, and a transform coefficient level.

A residual signal generated after intra or inter prediction may betransformed into a frequency domain through a transform process as apart of a quantization process. Here, a primary transform may use DCTtype 2 (DCT-II) as well as various DCT, DST kernels. On a residualsignal, these transform kernels may perform a separable transformperforming a 1D transform in a horizontal and/or vertical direction, ormay perform a 2D non-separable transform.

For example, DCT and DST types used in transform may use DCT-II, DCT-V,DST-I, and DST-VII as shown in following tables in a case of the 1Dtransform. For example, as shown in the table 1 and table 2, a DCT orDST type used in transform by composing a transform set may be derived.

TABLE 1 Transform set Transform 0 DST_VII, DCT-VIII 1 DST-VII, DST-I 2DST-VII, DCT-V

TABLE 2 Transform set Transform 0 DST_VII, DCT-VIII, DST-I 1 DST-VII,DST-I, DCT-VIII 2 DST-VII, DCT-V, DST-I

For example, as shown in FIG. 8 , according to an intra-prediction mode,different transform sets are defined for horizontal and verticaldirections. Next, the encoder/decoder may perform transform and/orinverse transform by using an intra-prediction mode of a currentencoding/decoding target block and transform of a relevant transformset. In this case, entropy encoding/decoding is not performed on thetransform set, and the encoder/decoder may define the transform setaccording to the same rule. In this case, entropy encoding/decodingindicating which transform is used among transforms of the transform setmay be performed. For example, when the size of a block is equal to orless than 64×64, three transform sets are composed as shown in table 2according to an intra-prediction mode, and three transforms are used foreach horizontal direction transform and vertical direction transform tocombine and perform total nine multi-transform methods. Next, a residualsignal is encoded/decoded by using the optimum transform method, wherebyencoding efficiency can be enhanced. Here, in order to perform entropyencoding decoding on information about which transform method is usedamong three transforms of one transform set, truncated unarybinarization may be used. Here, for at least one of vertical transformand horizontal transform, entropy encoding/decoding may be performed onthe information indicating which transform is used among transforms of atransform set.

After completing the above-described primary transform, the encoder mayperform a secondary transform to increase energy concentration fortransformed coefficients as shown in FIG. 9 . The secondary transformmay perform a separable transform performing a 1D transform in ahorizontal and/or vertical direction, or may perform a 2D non-separabletransform. Used transform information may be signaled or may be derivedby the encoder/decoder according to current and neighboring encodinginformation. For example, like the 1D transform, a transform set for thesecondary transform may be defined. Entropy encoding/decoding is notperformed on the transform set, and the encoder/decoder may define thetransform set according to the same rule. In this case, informationindicating which transform is used among transforms of the transform setmay be signaled, and the information may be applied to at least oneresidual signal through intra or inter prediction.

At least one of the number or types of transform candidates is differentfor each transform set. At least one of the number or types of transformcandidates may be variably determined based on at least one of thelocation, the size, the partition form, and the prediction mode(intra/inter mode) or direction/non-direction of the intra-predictionmode of a block (CU, PU, TU, etc.).

The decoder may perform a secondary inverse transform depending onwhether or not the secondary inverse transform is performed, and mayperform a primary inverse transform depending on whether or not theprimary inverse transform is performed from the result of the secondaryinverse transform.

The above-described primary transform and secondary transform may beapplied to at least one signal component of luma/chroma components ormay be applied according to the size/shape of an arbitrary coding block.Entropy encoding/decoding may be performed on an index indicating bothwhether or not the primary transform/secondary transform is used and theused primary transform/secondary transform in an arbitrary coding block.Alternatively, the index may be tacitly derived by the encoder/decoderaccording to at least one piece of current/neighboring encodinginformation.

The residual signal generated after intra or inter prediction goesthrough a quantization process after the primary and/or secondarytransform, and quantized transform coefficients go through an entropyencoding process, Here, the quantized transform coefficients may bescanned in diagonal, vertical, and horizontal directions based on atleast one of the intra-prediction mode or the size/shape of a minimumblock as shown in FIG. 10 .

In addition, the quantized transform coefficients on which entropydecoding is performed may be arranged in block forms by being inversescanned, and at least one of dequantization or inverse transform may beperformed on the relevant block. Here, as a method of inverse scanning,at least one of diagonal direction scanning, horizontal directionscanning, and vertical direction scanning may be performed.

For example, when the size of a current coding block is 8×8, primarytransform, secondary transform, and quantization may be performed on aresidual signal for the 8×8 block, and next, scanning and entropyencoding may be performed on quantized transform coefficients for eachof four 4×4 sub-blocks according to at least one of three scanning ordermethods shown in FIG. 10 . In addition, inverse scanning may beperformed on the quantized transform coefficients by performing entropydecoding. The quantized transform coefficients on which inverse scanningis performed become transform coefficients after dequantization, and atleast one of secondary inverse transform or primary inverse transform isperformed, whereby a reconstructed residual signal can be generated.

In a video encoding process, one block may be partitioned as shown inFIG. 11 , and an indicator corresponding to partition information may besignaled. Here, the partition information may be at least one of apartition flag (split_flag), a quad/binary tree flag (QB_flag), a quadtree partition flag (quadtree_flag), a binary tree partition flag(binarytree_flag), and a binary tree partition type flag (Btype_flag).Here, split_flag is a flag indicating whether or not a block ispartitioned, QB_flag is a flag indicating whether a block is partitionedin a quad tree form or in a binary tree form, quadtree_flag is a flagindicating whether or not a block is partitioned in a quad tree form,binarytree_flag is a flag indicating whether or not a block ispartitioned in a binary tree form, Btype_flag is a flag indicatingwhether a block is vertically or horizontally partitioned in a case ofpartition of a binary tree form.

When the partition flag is 1, it may indicate partitioning is performed,and when the partition flag is 0, it may indicate partitioning is notperformed. In a case of the quad/binary tree flag, 0 may indicate a quadtree partition, and 1 may indicate a binary tree partition.Alternatively, 0 may indicate a binary tree partition, and 1 mayindicate a quad tree partition. In a case of the binary tree partitiontype flag, 0 may indicate a horizontal direction partition, and 1 mayindicate a vertical direction partition. Alternatively, 0 may indicate avertical direction partition, and 1 may indicate a horizontal directionpartition.

For example, partition information for FIG. 11 may be derived bysignaling at least one of quadtree_flag, binarytree_flag, and Btype_flagas shown in table 3.

TABLE 3 quadtree_flag 1 0 1 0 0 0 0 0 0 binarytree_flag 1 0 0 1 0 0 0 00 1 1 0 0 0 0 Btype_flag 1 0 0 1

For example, partition information for FIG. 11 may be derived bysignaling at least one of split_flag, QB_flag, and Btype_flag as shownin table 2.

TABLE 4 split_flag 1 1 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 QB_flag 0 1 0 1 1Btype_flag 1 0 0 1

The partition method may be performed only in a quad tree form or onlyin a binary tree form according to the size/shape of a block. In thiscase, the split_flag may mean a flag indicating whether partitioning isperformed in a quad tree for or in a binary tree form. The size/shape ofa block may be derived according to depth information of a block, andthe depth information may be signaled.

When the size of a block is in a predetermined range, partitioning maybe performed only in a quad tree form. Here, the predetermined range maybe defined as at least one of the size of a maximum block or the size ofa minimum block that can be partitioned only in a quad tree form.Information indicating the size of a maximum/minimum block where apartition in the quad tree form is allowed may be signaled through abitstream, and the information may be signaled by a unit of at least oneof a sequence, a picture parameter, or a slice (segment). Alternatively,the size of a maximum/minimum block may be a fixed size that is presetin the encoder/decoder. For example, when the size of a block ranges256×256 to 64×64, partitioning may be performed only in a quad treeform. In this case, the split_flag may be a flag indicating whetherpartitioning is performed in a quad tree form.

When the size of a block is in a predetermined range, partitioning maybe performed only in a binary tree form. Here, the predetermined rangemay be defined as at least one of the size of a maximum block or thesize of a minimum block that can be partitioned only in a binary treeform. Information indicating the size of a maximum/minimum block where apartition in the binary tree form is allowed may be signaled through abitstream, and the information may be signaled by a unit of at least oneof a sequence, a picture parameter, or a slice (segment). Alternatively,the size of a maximum/minimum block may be a fixed size that is presetin the encoder/decoder. For example, when the size of a block ranges16×16 to 8×8, partitioning may be performed only in a binary tree form.In this case, the split_flag may be a flag indicating whetherpartitioning is performed in a binary tree form.

After partitioning one block in a binary tree form, when the partitionedblock is further partitioned, partitioning may be performed only in abinary tree form.

When the width or length size of the partitioned block cannot be furtherpartitioned, at least one indicator may not be signaled.

Besides the quad tree based binary tree partitioning, the quad treebased partitioning may be performed after the binary tree partitioning.

FIG. 12 is a view showing an operation of an encoding apparatusperforming an intra prediction method according to the presentinvention.

In step S1201 of FIG. 12 , a reference pixel for intra prediction may beconfigured. Then, in step S1202, intra prediction may be performed, andin step S1203, information on intra prediction may be encoded.

FIG. 13 is a view showing an operation of a decoding apparatusperforming an intra prediction method according to the presentinvention.

In step S1301 of FIG. 13 , information on intra prediction may bedecoded. Then, in step S1302, a reference pixel for intra prediction maybe configured, and in step S1303, intra prediction may be performed.

First, steps of configuring the reference pixel for intra predictionwill be described in detail with reference to FIGS. 14 to 17 (stepsS1201 and S1302).

FIG. 14 is a view showing a pixel that may be used for configuring areference pixel array pier for intra prediction.

As shown in FIG. 14 , a reference pixel for intra prediction of acurrent block B_(c) that is an encoding/decoding target block may beconfigured by using pixels within neighboring blocks that have beenalready encoded/decoded. For example, a referenced neighboring block maybe a block positioned at an upper side and/or a left side of the currentblock, but it is not limited thereto, the referenced neighboring blockmay be a block included in the same picture in which the current blockincluded. When a size of the current block is N×M, a number of referencepixels may be a positive integer including (2×N+2×M+1).

In order to configure reference pixels, availability checking for pixelsof the neighboring block may be performed. Availability checking for thepixels of the neighboring block may be performed in a predetermineddirection. For example, for availability checking, scanning may beperformed in a direction from a left lowermost side pixel to a rightuppermost side pixel. Alternatively, scanning may be performed in theopposite direction. Alternatively, scanning may be respectivelyperformed in different directions with respect to a left neighboringside pixel and an upper neighboring side pixel.

For example, when a reference pixel candidate of the current block ispositioned outside of the picture, the corresponding reference pixelcandidate may be designated as “marked as not available”.

For example, when a reference pixel candidate of the current blockbelongs to other slice, the corresponding reference pixel candidate maybe designated as “marked as not available”.

For example, when a reference pixel candidate of the current blockbelongs to a neighboring block that has been already encoded/decoded byinter prediction or constrained intra prediction, the correspondingreference pixel candidate may be designated as “marked as notavailable”.

Reference pixel candidates designated as “marked as not available”(hereinafter, referred as ‘non-available reference pixel candidate’ or‘non-available reference pixel’) may be replaced by using an availablereference pixel.

FIG. 15 is a view showing an embodiment of replacing a “non-availablereference pixel candidate” to a pixel value of an “available referencepixel candidate”.

In FIG. 15 , graded pixels indicate available reference pixels andblanked pixels indicate non-available reference pixels. In FIG. 15 ,availability checking may be performed in a direction from a leftlowermost side pixel to an upper rightmost side pixel.

FIG. 15(a) is a view showing an embodiment of replacing non-availablereference pixels when the non-available reference pixels are present inthe middle of a reference pixel array p_(ref), in other words, in themiddle of available reference pixels A and B.

In FIG. 15(a), a non-available reference pixel may be replaced bypadding a value of the reference pixel A that is adjacent to a firstnon-available reference pixel among available reference pixels of thereference pixel array (P_(pad)=P_(prev)=A). P_(pad) refers to a paddedpixel value, and P_(prev) refers to a previous adjacent availablereference pixel.

Alternatively, in FIG. 15(a), a non-available reference pixel may bereplaced with a pixel value that is derived by using at least twoavailable reference pixels. For example, available reference pixelspositioned at both ends of the non-available reference pixel may beused. For example, in FIG. 15(a), values of non-available referencepixels may be replaced by using pixel values of the available referencepixels A and B. For example, non-available reference pixels may bereplaced by using an average value or a weighted sum of pixel values ofavailable reference pixels A and B. In the present specification, aweighted sum may be used as including a weighted average.

Alternatively, a value of a non-available reference pixel may bereplaced with an arbitrary value between pixel values of the availablereference pixels A and B. Herein, non-available reference pixels may bereplaced with values different from each other. For example, the closerthe non-available reference pixel is to the reference pixel A, the morelikely the non-available reference pixel may be replaced with a pixelvalue that is close to a pixel value of the pixel A. Similarly, thecloser the non-available reference pixel is to the reference pixel B,the more likely the non-available reference pixel may be replaced with apixel value that is close to a pixel value of the pixel B. In otherwords, based on a distance from a non-available reference pixel to theavailable reference pixel A and/or the available reference pixel B, apixel value of a non-available reference pixel may be determined.

At least one of a plurality methods including the above methods may beselectively applied to replace a non-available reference pixel. A methodof replacing a non-available reference pixel may be signaled ininformation included in a bitstream, or a method that is predeterminedby an encoder and a decoder may be used. Alternatively, a method ofreplacing a non-available reference pixel may be derived by apredetermined method. For example, based on a difference between pixelvalues of the available reference pixels A and B and/or a number ofnon-available reference pixels, a method of replacing a non-availablereference pixel may be selected. For example, a method replacing anon-available reference pixel may be selected based on comparing adifference between pixel values of two available reference pixels to athreshold value, and/or comparing a number of non-available referencepixels to a threshold value. For example, when the difference betweenpixel values of two available reference pixels is larger than thethreshold value, and/or the number of non-available reference pixels islarger than the threshold value, the non-available reference pixel maybe replaced to have values different from each other.

A selection of a method of replacing a non-available reference pixel maybe performed in a predetermined unit. For example, the selection of themethod of replacing the non-available reference pixel may be performedby a unit of at least one of a video, a sequence, a picture, a slice, atile, a coding tree unit, a coding unit, a prediction unit and atransform unit. Herein, the selection of the method of replacing thenon-available reference pixel may be based on information signaled inthe above predetermined unit, or may be derived by the abovepredetermined unit. Alternatively, a method that is predetermined by anencoder and a decoder may be applied thereto.

FIG. 15(b) is a view showing an embodiment of replacing a non-availablereference pixel when an available reference pixel is not present infront of the non-available reference pixel in the reference pixel arrayp_(ref).

In FIG. 15(b), a non-available reference pixel may be replaced bypadding a pixel value of an available reference pixel A adjacent to thelast non-available reference pixel. For example, in FIG. 15(b), a firstnon-available reference pixel of the reference pixel array may bereplaced with a pixel value of the pixel A that is a first availablereference pixel within a scanning sequence. After determining a pixelvalue of the first non-available reference pixel of the reference pixelarray, the method described with reference to FIG. 15(a) may be appliedthereto. Accordingly, non-available reference pixels positioned from thefirst non-available reference pixel within the scanning sequence to theimmediately previous pixel of the first available reference pixel A maybe replaced with a pixel value of the reference pixel A(P_(pad)=P_(prev)=A). In addition, non-available reference pixelspositioned successive to the available reference pixel B may be replacedwith a pixel value of reference pixel B (P_(pad)=P_(prev)=B).

As a case not shown in FIG. 15 , for example, when no availablereference pixel is present in the reference pixel array p_(ref), all ofnon-available reference pixels may be replaced with arbitrary values.Herein, as the arbitrary values, a middle value of a pixel value rangereferring to a range that a reference pixel may have (for example, incase of an image having 8-bit as a bit depth B_(d), 2^(Bd-1)=128,B_(d)=8) may be used. Alternatively, a positive integer value between 0and 2^(Bd) may be used as the arbitrary values.

Before performing intra prediction using a reference pixel, filteringfir reference pixels may be performed.

After generating the reference pixel array p_(ref) from the neighboringblocks which have been already encoded/decoded, filtering for referencepixels may be performed based on a size N_(s) of the current blockand/or an intra prediction mode. For example, when the intra predictionmode of the current block is a directional prediction mode, filteringmay be performed based on a difference between a vertical directionalmode and/or a horizontal directional mode. For example, when the intraprediction mode intraPredMode of the current block is a directionalprediction mode, among a difference value with vertical directionalmodes (assuming 33 directional modes, index=26) and a difference valuewith horizontal directional modes (assuming 33 directional modes,index=10), a smaller value of the two values may be calculated,minDistVerHor=Min(Abs(intraPredMode−26), abs(intraPredMode−10)). Whenthe above smaller value minDistVerHor is greater than a threshold valueintraHorVerDistThresh that is assigned to a corresponding block size,that is, minDistVerHor >intraHorVerDistThresh, filtering may beperformed. When the above smaller value minDistVerHor is equal to orsmaller than the threshold value, filtering may not be performed.

FIG. 16 is a view exemplary showing a threshold valuentraHorVerDistThresh assigned to a block size N_(s).

For example, for a 4×4 block, 10 may be assigned as a threshold value,for a 8×8 block, 7 may be assigned as the threshold value, for a 16×16block, 1 may be assigned as the threshold value, for a 32×32 block, 0may be assigned as the threshold value, and for a 64×64 block, 10 may beassigned as the threshold value. The threshold values of FIG. 16 areexamples, and depending on a block size, arbitrary threshold values thatare identical or different from each other may be set as the thresholdvalues. The threshold value depending on the block size may be a valuethat is predetermined by an encoder and a decoder. Alternatively, thethreshold value may be a value that is derived based on informationsignaled through a bitstream and/or based on an internal parameter usedwhen encoding/decoding.

FIG. 17 is a view showing whether or not to perform filtering forreference pixels according to a block size and a directional predictionmode of a current block.

As shown in FIG. 17 , for the current block having a block size of 8×8,16×16, or 32×32, whether to perform filtering for reference pixels maybe determined according to a directional prediction mode. X marks meanthat filtering is not performed, and 0 marks mean that filtering isperformed.

According to a scanning sequence described with reference to FIGS. 14and 15 , filtering may be sequentially performed in an order from a leftlowermost side pixel to an upper rightmost side pixel of p_(ref).Alternatively, filtering for the p_(ref) may be performed in anarbitrary order. Herein, filtering for the first reference pixel (a leftlowermost side pixel) and the last reference pixel (an upper rightmostside pixel) may be skipped. A size of a filter tap may be a positiveinteger lager than 2 and including 3. When the size of the filter tap is3, filter coefficients may be, for example, ¼, ½, and ¼. Filtering maybe performed by using N reference pixels. The N reference pixels mayinclude a filtered reference pixel or a reference pixel before beingfiltered. For example, a weighted sum (or a weighted average) of Nreference pixels may be replaced with a pixel value of a filteringtarget pixel, Herein, the size of the filter tab may be determined basedon a number N, and the filter coefficient may be a weight used for theweighted sum. The weight may be determined based on positions of thefiltering target pixel and a reference pixel used for filtering. Forexample, the closer the filtering target pixel comes to the referencepixel used for filtering, the larger the weight may be applied.

As another embodiment to which filtering is applied, bi-linearinterpolation filtering may be performed for a current block having ablock size equal to or greater than a predetermined size. For example,for a current block having a block size equal to or larger than apredetermined size N_(S), a secondary differential value of a verticaldirection and/or a horizontal direction may be calculated.

For example, a secondary differential value of a vertical direction maybe calculated as 2×p_(ref)(−1, N_(s)/2)+p_(ref)(−1, N_(s))|. Forexample, a secondary differential value of a horizontal direction may becalculated as |p_(ref)(−1, −1)−2×p_(ref)(N_(s)/2, −1)+p_(ref)(N_(s),−1)|). The calculated secondary differential values may be compared torespective predetermined threshold values. The respective predeterminedthreshold values may be determined based on a bit depth B_(d). Forexample, the predetermined threshold value may be 2^(Bd-C). Herein, Cmay be an arbitrary integer between 1 and B_(d). Filtering may beperformed based on comparisons results between the calculated secondarydifferential values to the respective predetermined threshold values.

For example, when the below Formula 1 is satisfied, filtering may beperformed.

|p _(ref)(−1,−1)−2×p _(ref)(N _(s)−1,−1)+p _(ref)(2×N_(s)−1,−1)|<2^(Bd-C) and/or

|p _(ref)(−1,−1)−2×p _(ref)(−1,N _(s)−1)+p _(ref)(−1,2×N_(s)−1)|<2^(Bd-C)

(B _(d) is a bit-depth,1<=C<=positive integer of B _(d))  [Formula 1]

When the above Formula 1 is satisfied, a pixel value of a filteringtarget pixel may be calculated by performing hi-linear interpolationusing two reference pixels. Two pixels used for bi-linear interpolationmay be, for example, reference pixels positioned at both ends of areference pixel array in a vertical direction or in a horizontaldirection. An interpolation coefficient used for bi-linear interpolationmay be determined, for example, based on positions of the two referencepixels and the filtering target pixel. Filtering using bilinearinterpolation may be performed, for example, by using the Formula 2below.

p _(ref)(−1,y)=(N _(s)−1−y)/N _(s) ×p _(ref)(−1,−1)+(y+1)/N _(s) ×p_(ref)(−1,N _(s)−1), for y=0, . . . ,N _(s)−1, and/or

p _(ref)(x,−1)=(N _(s)−1−x)/N _(s) ×p _(ref)(−1,−1)+(x+1)/N _(s) ×p_(ref)(N _(s)−1,−1), for x=0, . . . ,N _(s)−1  [Formula 2]

As described above, when the reference pixels for intra prediction areconfigured in steps S1201 and S1302, intra prediction may be performedusing the reference pixels in steps S1202 and S1303.

In order to perform intra prediction for the current block, an intraprediction mode has to be determined. An encoding apparatus may performintra prediction by selecting a single intra prediction mode among aplurality of intra prediction modes. A decoding apparatus may performintra prediction by decoding an intra prediction mode of a current blockfrom information signaled from the encoder. The decoding of the intraprediction mode may be derived by decoding information on intraprediction, and the above process will be described later with adescription of step S1301.

Hereinbelow, steps S1202 and S1303 of performing intra prediction usingthe reference pixels will be described in detail with reference to FIGS.18 to 43 .

FIG. 18 is a view showing intra prediction when an intra prediction modeis a non-directional planar mode INTRA_PLANAR.

When the intra prediction mode is a non-directional planar modeINTRA_PLANAR, a prediction block may be calculated by a weighted sum ora weighted average of N reference pixels. The N reference pixels may bedetermined depending on a position (x, y) of a prediction target pixelwithin the prediction block. N may be a positive integer greater than 1,for example, 4.

As shown in FIG. 18 , when N=4 and a block size N_(s) is 4, a predictionvalue of a pixel positioning at (x, y) within the prediction block maybe determined by a weighted sum of an upper side reference pixel c, aleft side reference pixel b, a right upper side corner pixel d of thecurrent block, and a left lower side corner pixel a of the currentblock. When calculating the weighted sum, the below Formula 3 may beused.

$\begin{matrix}{{B_{C}\left( {x,y} \right)} = {{\frac{y + 1}{2*N_{S}}{p_{ref}\left( {{- 1},N_{S}} \right)}} + {\frac{N_{S} - 1 - x}{2*N_{S}}{p_{ref}\left( {{- 1},y} \right)}} + {\frac{N_{S} - 1 - y}{2*N_{S}}{p_{ref}\left( {x,{- 1}} \right)}} + {\frac{x + 1}{2*N_{S}}{p_{ref}\left( {N_{S} - 1} \right)}}}} & \left\lbrack {{Formula}3} \right\rbrack\end{matrix}$

FIG. 19 is a view showing intra prediction when an intra prediction modeis a non-directional DC mode INTRA_DC.

When the intra prediction mode is a non-directional DC mode INTRA_DC,all pixel values within a prediction block may be filled with an averagevalue of pixel values of reference pixels adjacent to a current block.When calculating the average value, the below Formula 4 may be used.

$\begin{matrix}{v_{DC} = {\frac{1}{2 \times N_{S}}\left( {{\sum\limits_{x = 0}^{N_{5 - 1}}{p_{ref}\left( {x,{- 1}} \right)}} + {\sum\limits_{y = 0}^{N_{5 - 3}}{p_{ref}\left( {{- 1},y} \right)}}} \right)}} & \left\lbrack {{Formula}4} \right\rbrack\end{matrix}$

In DC mode, filtering may be performed for N rows/columns of a left sideand/or an upper side of the current block, and N may be an integer equalto or greater than 1. For example, when N=1, as shown in FIG. 19 ,filtering may be performed for a first row of an upper side of thecurrent block and/or a first column of a left size. Filtering may beperformed, for example, by using the Formula 5 below.

$\begin{matrix}{{B_{C}\left( {0,0} \right)} = {\frac{1}{4}\left\lbrack {{p_{ref}\left( {{- 1},0} \right)} + {p_{ref}\left( {0,{- 1}} \right)} + {2*v_{DC}}} \right\rbrack}} & \left\lbrack {{Formula}5} \right\rbrack\end{matrix}$

In DC mode, a final prediction block may be obtained by obtaining afirst prediction block by using a V_(dc) value, and by applyingfiltering to N rows and/or columns of the first prediction block.Alternatively, after calculating the V_(dc) value, the final predictionblock may be directly obtained by assigning the V_(dc) value to afiltered value or by assigning the V_(dc) value to a pixel value of acorresponding pixel, based on a position of a target pixel within theprediction block.

When the intra prediction mode is a directional mode, the current blockmay be encoded/decoded based on N straight-directional modes. N may be apositive integer including 33, 65, etc. For example, in FIG. 17 , N is33 (from a mode 2 to a mode 34), each mode has a different direction.

FIG. 20 is a view showing an embodiment of angles between eachstraight-directional mode and a vertical direction among intraprediction modes predModeIntra including 33 straight-directional modes.

In addition to a straight-directional mode, a current block may beencoded/decoded based on M curved modes (M is a positive integer). Anumber M of curved modes may be determined by using parameters. Asparameters, for example, a curvature parameter cuv and/or a weightparameter cw may be used.

As exemplified in FIG. 20 , a mode 35 may refer to a curved mode from aright upper side to a left lower side direction, a mode 36 may refer toa curved mode from a left upper side to a tight lower side (type-1)direction, a mode 37 may refer to a curved mode from a left lower sideto a right upper side direction, a mode 38 may refer to a curved modefrom a left upper side to a right lower side (type-2) direction, a mode39 may refer to a curved mode from an upper side to a left lower sidedirection, a mode 40 may refer to a curved mode from an upper side to aleft upper side direction, a mode 41 may refer to a curved mode from aleft side to a right upper side direction, and a mode 42 may refer to acurved mode from a left side to a right lower side direction.

For respective curved modes of FIG. 20 , various curved predictions maybe performed based on the curvature parameter and/or the weightparameter.

The curvature parameter and/or the weight parameter which is used as aparameter for performing curved prediction is merely an example andvarious parameters may be used for generating a curved prediction block.For example, for block sizes different from each other, look-up-tablesspecifying angles fir searching a position of a reference pixel forcurved prediction at each position of a pixel may be equally used in anencoder/decoder.

For intra straight-directional prediction, a left side reference pixeland/or an upper side reference pixel which is used for prediction may bedifferently determined according to a direction of a prediction mode. Inaddition, for convenience of calculation, before performing prediction,as shown in FIG. 21 , a one-dimensional (1-D) reference pixel arrayp_(1,ref) may be generated from pia. A number of reference pixels mappedas p_(1,ref) may be differently determined according to an angle P_(ang)of a directional prediction mode.

FIG. 22 is a view showing an embodiment of generating p_(1,ref) for a4×4 block when a straight-directional mode is a horizontal direction.

For example, as shown in FIG. 17 , when a number of directional intraprediction modes is 33, from a mode 2 to a mode 18 arestraight-directional modes that perform prediction in a horizontaldirection. Herein, the generating of p_(1,ref) for the 4×4 block may beas shown in FIG. 22 .

FIG. 23 is a view showing an embodiment of generating p_(1,ref) for a4×4 block when a straight-directional mode is a vertical direction.

For example, as shown in FIG. 17 , When a number of directional intraprediction modes are 33, from a mode 19 to a mode 34 arestraight-directional modes that perform prediction in a verticaldirection. Herein, the generating of p_(1,ref) for the 4×4 block may beas shown in FIG. 23 .

Embodiments described with reference to FIGS. 22 and 23 are embodimentsin which a number of straight-directional modes is 33. Accordingly, whena number of straight-directional modes varies, generating p_(1,ref)based on P_(ang) may be performed in a different form while maintainingthe same method.

When generating a prediction block using P_(1,ref), interpolatedprediction in a real number unit may be performed. For example, based onan angle parameter intraPredAngle corresponding to eachstraight-directional prediction mode, an offset value iIdx and/or aweight iFact for prediction sample interpolation according to a positionof a pixel in a current block may be determined as below.

For example, when performing interpolation in a 1/32 pel unit, an offsetvalue and a weight for straight-directional modes that are from a mode19 to a mode 34 of FIG. 17 and which perform prediction in a verticaldirection may be determined by using the Formula 6 below.

iIdx=((y+1)*intraPredAngle)>>5

iFact=((y+1)*intraPredAngle)&31  [Formula 6]

A prediction sample value may be differently determined according to aniFact value of the above Formula 6. For example, when the iFact value isnot 0, a position of prediction in P_(1,ref) becomes a real number unitrather than an integer unit (full pixel location). Accordingly, aprediction sample value may be generated by using a plurality ofreference pixels that is adjacent to a real number position. Herein, theplurality of reference pixels may be positioned at, at least one of anupper side, a lower side, a left side, a right side, and a diagonal sideof the real number position. A number of reference pixels may be, 2, 3,or more. For example, a prediction sample value at a position (x, y) maybe generated by using the Formula 7 below.

predSamples[x][y]=((32−iFact)*p _(1,ref) [x+iIdx+1]+iFact*p _(1,ref)[x+iIdx+2]+16)>>5  [Formula 7]

For example, when the iFact value is 0, a prediction sample value may begenerated by using the Formula 8 below.

predSamples[x][y]=p _(1,ref) [x+iIdx+1]  [Formula 8]

When prediction modes are in a horizontal direction (from a mode 2 to amode 18 of FIG. 17 ), the Formula in which positions of x and y arechanged in the Formulas 6 to 8 may be applied. Described interpolatedprediction in a 1/32 pel unit may be an embodiment, interpolatedprediction in a 1/N pel (N is a positive integer) unit may be applied.

In case of a horizontal direction mode and/or a vertical direction modeamong directional prediction modes, reference pixel filtering for maynot be performed. In addition, by using a reference target pixel and areference pixel in which an x position and a y position thereof areidentical as a prediction sample, interpolated prediction may not benecessary. In addition, when prediction is available by using onlyreference pixels of an upper side or a left side, a process ofgenerating an 1-D reference pixel array p_(1,ref) may not be necessary.

In case of a horizontal direction mode and/or a vertical direction modeamong directional prediction modes, filtering may be additionallyperformed for boundary rows/columns of a prediction block aftergenerating the prediction block of the current block.

FIG. 24 is a view showing an embodiment of filtering boundaryrows/columns of a prediction block when the prediction mode is avertical direction.

As shown in FIG. 24 , filtering may be performed on a first column of aleft side of the prediction block. For filtering, for example, the belowFormula 9 may be used.

$\begin{matrix}{{B_{c}\left( {0,y} \right)} = {{p_{ref}\left( {0,{- 1}} \right)} + {\frac{1}{2}\left( {{p_{ref}\left( {{- 1},y} \right)} - {p_{ref}\left( {{- 1},{- 1}} \right)}} \right)}}} & \left\lbrack {{Formula}9} \right\rbrack\end{matrix}$

In addition, for directional prediction modes in horizontal and verticaldirections, filtering of another method may be performed on N rowsand/or columns of a left side and/or an upper side of the predictionblock. Herein, N may be an integer smaller than a block size of theprediction block.

For example, when a prediction block is generated using equal to orgreater than a plurality of reference pixel lines, filtering may beperformed by using a change amount between reference pixels present inthe same line or a change amount between reference pixels present indifferent lines.

In case of straight-directional prediction, when a curve having a numberof image characteristics is included in a current block, encodingefficiency may decrease. In order to improve this, intra prediction forthe current block may be performed by using curved modes.

In addition, when encoding/decoding is performed on a current blockincluding a curve by using only a straight-directional mode, a dataamount to be transmitted, in other words, signaling overhead, mayincrease since a target block may be divided into smaller blocks toreduce a prediction error. However, when encoding/decoding is performedon a current block having identical characteristics by using curvedprediction, encoding efficiency may increase since a prediction blockhaving the same level of a prediction error may be generated even thougha block is not divided into sub-blocks.

In case of straight-directional prediction, as described above,generating prediction values of positions (x, y) of all pixels withinthe prediction block may use a reference pixel value of a referencepixel positioned at spaced apart by intraPredAngle that corresponds to aprediction mode predModeIntra.

For example, in FIG. 20 , when predModeIntra is 2, a prediction value ofan arbitrary position (x, y) within the prediction block may becalculated by using a reference pixel positioned at 32 degrees aparttoward a left lower side based on a right angle direction.

In case of curved prediction, different to straight-directionalprediction, prediction may be performed by using reference pixels havingangles different from each other (or predModeIntra having anglesdifferent from each other) according to a position (x, y) of aprediction target pixel Within the prediction block.

FIG. 25 is a view showing an embodiment using reference pixels havingdifferent angles according to a position of a pixel within theprediction block.

For example, as shown in FIG. 25(a), a prediction value may be generatedin a pixel unit within the prediction block by using reference pixelspositioned at angles different from each other.

Alternatively, as shown in FIG. 25(b), a prediction value may begenerated in a horizontal line unit within the prediction block by usingreference pixels positioned at angles different from each other.

Alternatively, as shown in FIG. 25(c), a prediction value may begenerated in a vertical line unit within the prediction block by usingreference pixels positioned at angles different from each other.

Alternatively, as shown in FIG. 25(d), a prediction value may begenerated in a diagonal line unit within the prediction block by usingreference pixels positioned at angles different from each other.

Alternatively, as shown in FIG. 25(e), a prediction value may begenerated in a right angle line (L-shape line) unit within theprediction block by using reference pixels positioned at anglesdifferent from each other.

Intra prediction may be performed by selecting one method among theplurality of methods described with reference to FIG. 25 . The selectingof the one method may be performed in a predetermined unit. For example,the selection of the method may be performed in a unit of at least oneof a video, a sequence, a picture, a slice, a tile, a coding tree unit,a coding unit, a prediction unit and a transform unit. Herein, theselection may be based on information signaled in the predetermined unitor may be derived by the predetermined unit. Alternatively, a methodpredetermined by an encoder and a decoder may be applied.

When generating a curved intra prediction block by grouping by line, N(N is a positive integer) angles capable of being used for each line maybe stored in and used as an LUT.

When converting a two-dimensional block form coefficient into aone-dimensional block form coefficient by generating and transforming aresidual block between a curved prediction block and a current block,scanning methods different from each other may be applied according to atype of selected curved prediction. For scanning, for example, up rightscan, vertical scan, horizontal scan, zigzag scan, etc. may be applied.

When generating a prediction block by performing directional ornon-directional intra prediction, a reference pixel of at least one of aplurality of lines (N-lines, N is a positive integer)) which is adjacentto the current block at a left side and/or an upper side of may be used.

FIG. 26 is a view showing an embodiment of a reference pixel of aplurality of lines, the reference pixel being used for intra predictionof the current block.

As shown in FIG. 26 , when predicting a 4×4 block by using fourreference lines, a reference pixel may be generated from one referenceline among the four reference lines

Alternatively, the reference pixel may be generated from four referencelines different from each other.

Alternatively, the reference pixel may be generated by applying aweighted sum to a reference line of a plurality of reference linesselected from four reference lines (for example, equal to or greaterthan 2 and equal to or less than 4).

Intra prediction may be performed by selecting one method among theplurality of methods described with reference to FIG. 26 . The selectingof the single method may be performed in a predetermined unit. Forexample, the selection of the method may be performed in a unit of atleast one of a video, a sequence, a picture, a slice, a tile, a codingtree unit, a coding unit, a prediction unit and a transform unit.Herein, the selection may be based on information signaled in thepredetermined unit or may be derived in the predetermined unit.Alternatively, a method predetermined by an encoder and a decoder may beapplied.

The directional or non-directional intra prediction may be applied to asquare shaped block and/or a non-square shaped block.

As an embodiment of curved intra prediction, as described with referenceto FIG. 20 , a position of a reference pixel for generating a predictionvalue of an arbitrary position (x, y) within a prediction block may bedetermined by using the curvature parameter cuv and the weight parametercw_(i)(i=0, 1, . . . N_(S)−1, N_(S): block size).

For example, in case of curved intra prediction ‘from a right upper sideto a left lower side’, a position of a reference pixel for generating aprediction value of an arbitrary position (x, y) within a predictionblock may be determined by a row unit as the Formula 10 below.

y ^(th) row→p(pos,−1), where pos=x+1/2*(x+y)+cw _(y) *cuv*(x+1) for y=0,. . . ,N _(s)−1  [Formula 10]

In case of curved intra prediction using the above Formula 10, byadjusting cuv, a size of a curvature may be adjusted. cuv may be a realnumber equal to or greater than zero. For example, the larger cuv valuebecomes, the larger curvature becomes, and positions of reference pixelsmay move to the right. Alternatively, the smaller the cuv value becomes,the smaller the curvature becomes, and the positions of the referencepixel may move to the left (up to the position of x).

When a target block is N×M, cw_(i) may be a parameter including Nweights that refers to a height of the block or a number of rows. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingrow may be adjusted by adjusting Mi. For example, the larger the cw_(i)value becomes, positions of reference pixels used by the predictionpixel of an i^(th) row may move to the right. Alternatively, the smallerthe cw_(i) value becomes, the positions of the reference pixels may moveto the left (up to a position of x).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight row parametermi.

FIG. 27 is a view showing an embodiment of performing curved predictionin a direction from a right upper side to a left lower side by applyingcuv=0.1, cw₀=1.0, cw₁=1.2, cw₂=1.4, and cw₃=1.6 to a current blockhaving a 4×4 size.

FIG. 28 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 27 , of a position of a reference pixel used by aprediction pixel within a current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is a positive integer unit, the prediction target pixelpredPixels[x][y] may be derived by a reference pixel p(pos, −1). pos mayrefer to a position of the reference pixel.

For example, when the position of the reference pixel of the predictiontarget pixel is a real number inter unit, predPixels[x][y] may bederived as an interpolated prediction number obtained by perforatinginterpolated prediction in 1/N pel unit on p(floor(pos), −1) andp(ceil(pos), −1). floor(pos) may be an integer value equal to or smallerthan pos, and refer to the maximum value. ceil(pos) may be an integerequal to or greater than pos, and refer to the minimum value.

As described above, for convenience of calculation, p_(ref) may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 27 , exceeding P(7, −1)) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from a left upper sideto a right lower side (type-1)’, a position of a reference pixel forgenerating a prediction value of an arbitrary position (x, y) within aprediction block may be determined by a row unit as the Formula 11below.

y ^(th) row→p(pos,−1), where pos=x−1/2*(N _(s)−1−x+y)−cw _(y) *cuv*(N_(s) −x) for y=0,1, . . . ,N _(s)−1  [Formula 11]

In case of curved intra prediction using the above Formula 11, a size ofa curvature by be adjusted by adjusting cuv. cuv may be a real numberequal to or greater than zero. For example, the larger the cuv valuebecomes, the larger curvature becomes, and positions of reference pixelsmay move to the left. Alternatively, the smaller the cuv value becomes,the smaller curvature becomes, and the positions of the reference pixelsmay move to the right (up to a position of x).

When a target block is N×M, cw_(i) may be a parameter including Nweights that refers to a height of the block or a number of rows. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingrow may be adjusted by adjusting mi. For example, the larger the cw_(i)value becomes, positions of reference pixels used by prediction pixelsof an i^(th) row may move to the left. Alternatively, the smaller thecw_(i) value becomes, the positions of the reference pixels may move tothe tight (up to a position of x).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight row parametercw_(i).

FIG. 29 is a view showing an embodiment of performing curved predictionin a direction from a left upper side to a right lower side (type-1) byapplying cuv=0.1, cw₀=1.0, cw₁=1 cw₂=0.4, and cw₃=1.6 to a current blockhaving a 4×4 size.

FIG. 30 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 29 , of a position of a reference pixel used by aprediction pixel within a current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is a positive integer unit, prediction target pixelpredPixels[x][y] may be derived as a reference pixel p(pos, −1).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in 1/N pel unit on p(floor(pos), −1) and p(ceil(pos), −1).

As described above, for convenience of calculation, p_(ref) may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 29 , exceeding P(−7, 1))) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from a left lower sideto a right upper side’, a position of a reference pixel for generating aprediction value of an arbitrary position (x, y) within the predictionblock may be determined by a column unit as the Formula 12 below.

x ^(th) column→p(−1,pos), where pos=y+1/2*(x+y)cw _(x) *cuv*(y+1) forx=0,1, . . . ,N _(s)−1  [Formula 12]

In case of curved intra prediction using the above Formula 12, a size ofa curvature may be adjusted by adjusting cuv. cuv may be a real numberequal to or greater than zero. For example, the larger the cuv valuebecomes, the larger the curvature becomes, and positions of referencepixels may move downwards. Alternatively, the smaller the cuv valuebecomes, the smaller the curvature becomes, and the positions of thereference pixels may move upwards (up to a position of y).

When a target block is N×M, cw_(i) may be a parameter including Mweights that refers to a width of the block or a number of columns. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingcolumn may be adjusted by adjusting cw_(i). For example, the larger thecw_(i) value becomes, positions of reference pixels used by predictionpixels of an i^(th) column may move downwards. Alternatively, thesmaller the cw_(i) value becomes, the positions of the reference pixelsmay move upwards (up to a position of y).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight columnparameter cw_(i).

FIG. 31 is a view showing an embodiment of performing curved predictionin a direction from a left lower side to a right upper side by applyingcuv=0.1, cw₀=1.0, cw₁=1.2, cw₂=1.4, and cw₃=0.6 to a current blockhaving a 4×4 size.

FIG. 32 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 31 , of a position of a reference pixel used by aprediction pixel within a current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is an integer unit, the prediction target pixel predPixels[x][y]may be derived as a reference pixel p(−1, pos).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in 1/N pel unit on p(−1, floor(pos)) and p(−1, ceil(pos)).

As described above, for convenience of calculation, p_(ref) may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 31 , exceeding P(−1, 7)) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from a left upper sideto a right lower side (type-2)’, a position of a reference pixel forgenerating a prediction value of an arbitrary position(x, y) within theprediction block may be determined by a column unit as the Formula 13below.

x ^(th) column→p(−1,pos), Where pos=y−1/2*(N _(s)−1−y+x)cw _(x) *cuv*(N_(s) −y) for x=0,1, . . . ,N _(s)−1  [Formula 13]

In case of curved intra prediction using the above Formula 13, a size ofa curvature may be adjusted by adjusting cuv. cuv may be a real numberequal to or greater than zero. For example, the larger the cuv valuebecomes, the larger the curvature becomes, and positions of referencepixels may move upwards. Alternatively, the smaller the cuv valuebecomes, the smaller the curvature becomes, and the positions of thereference pixels may move downwards (up to a position of y).

When a target block is N×M, cw_(i) may be a parameter including Mweights that refer to a width of the block or a number of columns. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingcolumn may be adjusted by adjusting cw_(i). For example, the larger thecw_(i) value becomes, positions of reference pixels used by predictionpixels of an i^(th) column may move upwards. Alternatively, the smallerthe cw_(i) value becomes, the positions of the reference pixels may movedownwards (up to a position of y).

Accordingly, various forms of curved intra prediction may be performedby the curvature parameter cuv and/or the weight column parametercw_(i).

FIG. 33 is a view showing an embodiment of performing curved predictionin a direction from a left upper side to a right lower side (type-2) byapplying cuv=0.1, cw₀=1.0, cw₁=1.2, cw₂=1.4, and cw₃=1.6 to a currentblock having a 4×4 size.

FIG. 34 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 33 , of a position of a reference pixel used by aprediction pixel within the current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is an integer unit, the prediction target pixel predPixels[x][y]may be derived as a reference pixel p(−1, pos).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in 1/N pel unit on p(−1, floor(pos)) and p(−1, ceil(pos)).

As described above, for convenience of calculation, p_(ref) may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 33 , exceeding P(−1, −7)) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from an upper side to aleft lower side’, a position of a reference pixel for generating aprediction value of an arbitrary position(x, y) within the predictionblock may be determined by a row unit as the Formula 14 below.

y ^(th) row→p(pos,−1), where pos=x+cw _(y) *cuv*y for y=0,1, . . . ,N_(s)−1  [Formula 14]

In case of curved intra prediction using the above Formula 14, a size ofa curvature may be adjusted by adjusting cuv. cuv may be a real numberequal to or greater than zero. For example, the larger the cuv valuebecomes, the larger the curvature becomes, and positions of referencepixels may move to the right. Alternatively, the smaller the cuv valuebecomes, the smaller the curvature becomes, and the positions of thereference pixels may move to the left (up to a position of x).

When a target block is N×M, cw_(i) may be a parameter including Nweights that refers to a height of the block or a number of rows. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingrow may be adjusted by adjusting mi. For example, the larger the cw_(i)value becomes, positions of reference pixels used by prediction pixelsof an i^(th) row may move to the right. Alternatively, the smaller thecw_(i) value becomes, the positions of the reference pixels may move tothe left (up to a position of x).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight row parametercw_(i).

FIG. 35 is a view showing an embodiment of performing curved predictionin a direction from an upper side to a left lower side by applyingcuv=0.6, cw₀=1.4, cw₂=1.8, and cw₃=2.2 to a current block having a 4×4size.

FIG. 36 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 35 , of a position of a reference pixel used by aprediction pixel within the current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is an integer unit, the prediction target pixel predPixels[x][y]may be derived as a reference pixel p(pos, −1).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in II/N pel unit on p(floor(pos), −1) and p(ceil(pos), −1).

As described above, for convenience of calculation, p_(ref) may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 35 , exceeding P(7, −1)) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from an upper side to aright lower side’, a position of a reference pixel for generating aprediction value of an arbitrary position(x, y) within the predictionblock may be determined by a row unit as the Formula 15 below.

y ^(th) row→p(pos,−1), where pos=x−cw _(y) *cuv*y for y=0,1, . . . ,N_(s)−1  [Formula 15]

In case of curved intra prediction using the above Formula 15, a size ofa curvature may be adjusted by adjusting cuv, cuv may be a real numberequal to or greater than zero. For example, the larger the cuv valuebecomes, the larger the curvature becomes, and positions of referencepixels may move to the left. Alternatively, the smaller the cuv valuebecomes; the smaller the curvature becomes, and the positions of thereference pixels may move to the right (up to a position of x).

When a target block is N×M, cw_(i) may be a parameter including Nweights that refers to a height of the block or a number of rows. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingrow may be adjusted by adjusting cw_(i). For example, the larger thecw_(i) value becomes, positions of reference pixels used by predictionpixels of an i^(th) row may move to the left. Alternatively, the smallerthe cw_(i) value becomes, the positions of the reference pixels may moveto the tight (up to a position of x).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight row parametercw_(i).

FIG. 37 is a view showing an embodiment of performing curved predictionin a direction from an upper side to a right lower side by applyingcuv=0.6, cw₀=1.0, cw₁=1.4, cw₂=1.8, and cw₃=2.2 to a current blockhaving a 4×4 size.

FIG. 38 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 37 , of a position of a reference pixel used by aprediction pixel within the current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is an integer unit; the prediction target pixel predPixels[x][y]may be derived as p(pos, −1).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in 1/N pel unit on p(floor(pos), −1) and p(ceil(pos), −1).

As described above, for convenience of calculation, pier may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 37 , exceeding P(−7, −1)) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from a left side to aright upper side’, a position of a reference pixel for generating aprediction value of an arbitrary position(x, y) within the predictionblock may be determined by a column unit as the Formula 16 below.

x ^(th) column→p(pos,−1), where pos=y+cw _(x) *cuv*x for x=0,1, . . . ,N_(s)−1  [Formula 16]

In case of curved intra prediction using the above Formula 16, a size ofa curvature may be adjusted by adjusting cuv. cuv may be a real numberequal to or greater than zero. For example; the larger the cuv valuebecomes, the larger the curvature becomes, and positions of referencepixels may move downwards. Alternatively, the smaller the cuv valuebecomes, the smaller the curvature becomes, and the positions of thereference pixels may move upwards (up to a position of y).

When a target block is N×M, cw_(i) may be a parameter including Mweights that refers to a width of the block or a number of columns. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingcolumn may be adjusted by adjusting cw_(i). For example, the larger thecw_(i) value becomes, positions of reference pixels used by predictionpixels of an i^(th) column may move downwards. Alternatively, thesmaller the cw_(i) value becomes, the positions of the reference pixelsmay move upwards (up to a position of y).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight columnparameter cw_(i).

FIG. 39 is a view showing an embodiment of performing curved predictionin a direction from a left side to a right upper side by applyingcuv=0.6 cw₀=1.0, cw₁=1.4, cw₂=0.8, and cw₃=2.2 to a current block havinga 4×4 size.

FIG. 40 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 39 , of a position of a reference pixel used by aprediction pixel within the current block.

In order to generate a prediction pixel value, described interpolatedprediction in 1/N pel unit may be performed. N may be a positiveinteger.

For example, when a position of a reference pixel of a prediction targetpixel is an integer unit, the prediction target pixel predPixels[x][y]may be derived as a reference pixel p(−1, pos).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in 1/N pel unit on p(−1, floor(pos)) and p(−1, ceil(pos)).

As described above, fir convenience of calculation, pier may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 39 , exceeding P(−1, 7)) of an available reference pixel,calculated positions of all reference pixels may be used after beingconverted into respective normalized values by matching with the maximumrange of the available reference pixel.

For example, in case of curved intra prediction ‘from a left side to aright lower side’, a position of a reference pixel for generating aprediction value of an arbitrary position(x, y) of the prediction blockmay be determined by a column unit as the Formula 17 below.

x ^(th) column→p(pos,−1), where pos=y−cw _(x) *cuv*x for x=0,1, . . . ,N_(s)−1  [Formula 17]

In case of curved intra prediction using the above Formula 17, a size ofa curvature may be adjusted by adjusting cuv. cuv may be a real numberequal to or greater than zero. For example, the larger the cuv valuebecomes, the larger the curvature becomes, and positions of referencepixels may move upwards. Alternatively, the smaller the cuv valuebecomes, the smaller the curvature becomes, and the positions of thereference pixels may move downwards (up to a position of y).

When a target block is N×M, cw_(i) may be a parameter including Mweights that refer to a width of the block or a number of columns. Eachweight may be a real number equal to or greater than zero. A position ofa reference pixel used by a prediction pixel included in a correspondingcolumn may be adjusted by adjusting cw_(i). For example, the larger thecw_(i) value becomes, positions of reference pixels used by predictionpixels of an i^(th) column may move upwards. Alternatively, the smallerthe cw_(i) value becomes, the positions of the reference pixels may movedownwards (up to a position of y).

Accordingly, various forms of curved intra prediction may be performedby combining the curvature parameter cuv and/or the weight columnparameter cw_(i).

FIG. 41 is a view showing an embodiment of performing curved predictionin a direction from a left side to a right lower side by applyingcuv=0.6, cw₀=1.0, cw₁=1.4, cw₂=1.8, and cw₃=2.2 to a current blockhaving a 4×4 size.

FIG. 42 is a view showing an embodiment, as a result of applying cuv andcw_(i) of FIG. 41 , of a position of a reference pixel used by aprediction pixel within the current block.

In order to generate a prediction pixel value, described interpolatedprediction may be performed. N may be a positive integer.

For example, when a position of a reference pixel of a prediction targetpixel is an integer unit, the prediction target pixel predPixels[x][y]may be derived as a reference pixel p(−1, pos).

For example, when the position of the reference pixel of the predictiontarget pixel is a real number unit, predPixels[x][y] may be derived asan interpolated prediction value obtained by performing interpolatedprediction in 1/N pel unit on p(−1, floor(pos)) and p(−1, ceil(pos)).

As described above, for convenience of calculation, pier may beconverted into p_(1,ref) before generating the prediction sample value.

When a position pos of a reference pixel exceeds the maximum range (inFIG. 41 , exceeding P(−1, −7)) of an available reference pixel,calculated positions of all reference pixels may, be used after beingconverted into respective normalized values by matching with the maximumrange of the reference pixel.

In the embodiments described with reference to FIGS. 27 to 42 , a singlecurvature parameter cuv is applied to a current block, and a singleweight parameter cw is applied to a row or a column of the currentblock. However, it is not limited thereto. In other words, at least onecurvature parameter cuv and/or at least one weight parameter cw_(i) maybe applied to the current block. For example, as described withreference to FIG. 25 , different curvature parameters cuv and differentweight parameters cw_(i) may be applied to a pixel unit, a horizontalline unit, a vertical line unit, a diagonal line unit, a right angleline unit, a sub-block unit, and/or an arbitrary pixel group unit of thecurrent block.

FIG. 43 is a view showing another embodiment of curved intra prediction.

As shown in FIG. 43 , when a straight intra prediction mode is selected,curved intra prediction may be additionally performed based on thestraight intra prediction mode.

For example, when a selected intra prediction mode is a non-directionalmode (PLANAR_MODE or DC_MODE), curved prediction may not be performed.

In FIG. 43(a), when a selected straight intra prediction mode isincluded in a range A, curved prediction may be performed on at leastone of a direction from a left lower side→a right upper side and adirection from a left side→a right upper side.

Alternatively, in FIG. 43(a), when the selected straight intraprediction mode is included in a range B, curved prediction may beperformed on at least one of a direction from a left upper side→a rightlower side (Type2) and a direction from a left side→a right lower side.

Alternatively, in FIG. 43(a), when the selected straight intraprediction mode is included in a range C, curved prediction may beperformed on at least one of a direction from a left upper side→a rightlower side (Type 1) and a direction from an upper side→a right lowerside.

Alternatively, in FIG. 43(a), when the selected straight intraprediction mode is included in a range D, curved prediction may beperformed on at least one of a direction from a right upper side→a leftlower side and a direction of an upper side→a left lower side.

Alternatively, in FIG. 43(b), when the selected straight intraprediction mode is included in a range A, curved prediction may beperformed on at least one of a direction from a left side→a right lowerside and a direction from a left side→a right upper side.

Alternatively, in FIG. 43(b), when the selected straight intraprediction mode is included in a range B, curved prediction may beperformed on at least one of a direction from an upper side→a left lowerside and a direction from an upper side→a right lower side.

Hereinbelow, steps of encoding or decoding information on intraprediction will be described in detail with reference to FIGS. 44 to 46(S1203 and S1301).

An encoding apparatus according to the present disclosure may encodeinformation on intra prediction to a bitstream in step S1203. Theencoding may include entropy encoding.

FIG. 44 is a view showing an embodiment of a syntax structure of abitstream including information on intra prediction according to thepresent disclosure.

As shown in FIG. 44 , the information on intra prediction may include atleast one piece of information among information below.

-   -   MB/(Most Probable Mode) flag: prev_intra_luma_pred_flag    -   MPM index: mpm_idx    -   Intra prediction mode information on luma component:        rem_intra_luma_pred_mode    -   Intra prediction mode information on chroma component:        intra_chroma_pred_mode    -   Curvature parameter of curved intra prediction mode: cuv1, cuv2,        . . . .    -   Weight parameter of curved intra prediction mode: cw1, cw2, . .        . .    -   Look-up-table (LUT) for curved intra prediction

The encoding apparatus may encode the information on intra prediction toa bitstream based on at least one of the above encoding parameters.

When an MPM (Most Probable Mode) flag is 1, an intra prediction mode ofa luma component may be derived from candidate modes including intramodes of adjacent units having been already encoded/decoded by using artMPM index mpm_idx.

When the MPM (Most Probable Mode) flag is 0, the intra prediction modeof the luma component may be encoded/decoded by using intra predictionmode information on luma component rem_intra_luma_pred_mode.

An intra prediction mode of a chroma component may be encoded/decoded byusing intra prediction mode information on chroma componentintra_chroma_pred_mode and/or corresponding intra prediction mode of achroma component block.

A curvature parameter cuv of the curved intra prediction mode may referto a curvature applied to the curved intra prediction mode. Curved intraprediction may be performed on a current block by using at least onecuv. A curvature parameter may be derived from at least one curvatureparameter among curvature parameters of neighboring blocks.

A single or a plurality of weight parameters cw of the curved intraprediction mode may be applied to the current block. When a plurality ofweight parameters cw is applied thereto, different weight parameters maybe applied to a predetermined unit such as pixel, row, column, orsub-block, etc. of the current block. The weight parameter may bederived from at least one weight parameter among weight parameters ofneighboring blocks.

Neighboring blocks for deriving the curvature parameter and/or theweight parameter may be blocks adjacent to the current block at an upperside, a left side and/or a right side and which have been alreadyencoded/decoded.

Various forms of curved intra prediction may be performed by using atleast one of cuv and cw.

When N and M cws are used, intra prediction of the current block may beperformed by generating at least (N×M)×4 prediction blocks.

For example, when a single uv and a single cw are used, intra predictionof the current block may be performed by generating at least fourprediction blocks.

For example, when two cuvs and a single cw are used, intra prediction ofthe current block may be performed by generating at least eightprediction blocks.

For example, when a single cuv and two cws are used, intra prediction ofthe current block may be performed by generating at least eightprediction blocks.

For example, when two cuvs and two cws are used, intra prediction of thecurrent block may be performed by generating at least sixteen predictionblocks.

Information on at least two cuvs and/or cws may be encoded/decoded byusing a default value and a delta value. Herein, the default value mayrefer to a single cuv value and/or a single cw value, and the deltavalue may be a constant value.

For example, when 2 cuvs are used in the current block, two curvatureparameters may be default_cuv and default_cuv+delta_cuv.

For example, when N cuvs are used in the current block, N curvatureparameters may be default_cuv, default_cuv+delta_cuv,default_cuv+2*delta_cuv, . . . , and default_cuv (N−1)*delta_cuv.(Herein, N is a positive integer more than 2).

For example, when 2N+1 cuvs are used in the current block, 2N+1curvature parameters may be default_cuv, default_cuv+delta_cuv,default_cuv−delta_cuv, default_cuv+2*delta_cuv, default_cuv−2*delta_cuv,. . . , default_cuv+N*delta_cuv, and default_cuv−N*delta coy. (Herein, Nis a positive integer more than 1).

For example, when two cws are used in the current block, two weightparameters may be default_cw, and default_cw+delta_cw. (Herein,default_cw+delta_cw is a summation of an element unit of a vector).

For example, when M cws are used in the current block, M weightparameters may be default_cw, default_cw+delta_cw,default_cw+2*delta_cw, . . . , and default_cw+(M−1)*delta_cw. (Herein,default_cw+delta_cw is a summation of an element unit of a vector, M ispositive integer more than 2).

For example, when 2M+1 cws are used in the current block. 2M+1 curvatureparameters may be default_cw, default_cw+delta_cw,default_cw−default_cw, default_cw+2*delta_cw, default_cw−2*delta_cw, . .. , default_cw+M*delta_cw, and default_cw−M*delta_cw. (Herein, M is apositive integer more than 1).

Information on cuv and/or cw which is described above may be encoded toa bitstream or may be decoded from a bitstream. Alternatively, anencoder or a decoder may share and store information on a number of cuvsand/or cws or a value of cuv and/or cw in a format, for example, alook-up table.

When encoding/decoding, at least one piece of the information on intraprediction, at least one method among binarization methods below may beused.

-   -   Binarization method using truncated rice    -   Binarization method using K-th order Exp_Golomb    -   Binarization method using constrained K-th order Exp_Golomb    -   Binarization method using fixed-length    -   Unary binarization method    -   Binarization method using truncated unary

A decoding apparatus according to the present disclosure may receive anencoded bitstream which is encoded in step S1203, and decode informationon intra prediction from the received encoded bitstream in step S1301.The decoding may include entropy decoding.

Hereinbelow, detailed descriptions about overlapped parts with stepS1203 among descriptions of step 1301 are omitted. The decodingapparatus receives an encoded bitstream from the encoding apparatus anddecode the received encoded bitstream. Accordingly, in addition to thedescriptions about a syntax structure, a syntax element, semantics ofthe bitstream among descriptions of step S1203, descriptions that arenot unique features of the encoder may be applied to step S1301.

Information on intra prediction may include at least one piece ofinformation of the information which is descried with reference to FIG.44 .

The decoding apparatus may decode the information on intra predictionfrom the bitstream based on at least one parameter among encodingparameters.

A curved intra prediction mode may derive a pixel prediction valuewithin a reference pixel by using a reference pixel having differentangle according to a position (x, y) of a pixel within a predictionblock. Pixels within the prediction block may be grouped in a pluralityof groups (pixel groups). In addition, a first group among the pluralityof groups may use a directional intra prediction mode having an angledifferent from a second group. Each group may include at least onepixel. Each group may have a shape of a triangular, a square, or othergeometric shapes.

When performing intra prediction on a current block, signaling overheadfor transmitting an index of the selected prediction mode may be reducedsince a number of directional/non-directional modes are present. Forthis, an intra prediction mode of a current block may be encoded/decodedby using intra modes of adjacent units which have been alreadyencoded/decoded.

A selected intra prediction mode for a current block of a luma componentmay be encoded/decoded as below.

For example, N intra prediction modes may be transmitted in an indexform of an MPM (most probable modes) list having M entries. Herein, Nand M may be a positive integer.

For example, N intra prediction modes may be encoded/decoded by using afixed-length binarization.

When the intra prediction mode is encoded/decoded by using the MPM list,M entries including intra prediction modes selected by adjacent blockswhich have been already encoded/decoded may be included in the MPM list.

FIG. 45 is a view exemplary showing two blocks B_(a) and B_(b) adjacentto a current block B_(c) and which have been already encoded/decoded.

As shown in FIG. 45 , B_(a) and B_(b) may be defined at position of ajust left sided pixel (x_(a), y_(a)) and a just upper sided pixel(x_(b), y_(b)) based at a left upper sided pixel(x_(c), y_(c)) of atarget block.

When an intra prediction mode is encoded/decoded by using an MPM, Mprediction mode candidates that will be included in an MPM list may bedetermined according to intra prediction modes selected by adjacentblocks. A number M of prediction mode candidates that will be includedin the MPM list may be fixed by the encoder/decoder, or may be variablydetermined by the encoder/decoder. For example, information on a numberof prediction mode candidates constituting the MPM list may be signaled.The information may be signaled in at least one level of a sequence, apicture, a slice, and a block. The number of prediction mode candidatesconstituting the MPM list may be variably determined by considering asize/shape of a prediction block, whether or not asymmetrical/asymmetrical partition is.

In FIG. 45 , candidate intra prediction mode CandIntraPredModeX, (X is Aor B), may be determined by performing availability checking on B_(a)and/or B_(b). When B_(a) and/or B_(b) is not available, or isencoded/decoded based on intra prediction (inter coded), or whenpcm_flag is 1, CandIntraPredModeX may be determined as a DC mode. WhenB_(a) and/or B_(b) is encoded/decoded based on intra prediction (intercoded), CandIntraPredModeX may be determined as an intra prediction modeof B_(a) and/or B_(b).

In addition, an MPM candidate list candModeList[x] may be filled byusing initialized CandIntraPredModeX. As the prediction mode candidatesconstituting the MPM list, at least one of an intra prediction mode ofan adjacent block, a mode derived by adding/subtracting a predeterminedconstant value to an intra prediction mode of an adjacent block, and adefault mode may be used. The predetermined constant value may refer to1, 2, or an integer more than 2. The default mode may refer to a Planarmode, a DC mode, an Horizontal/vertical mode, etc.

For example, when CandIntraPredModeA and CandIntraPredModeB areidentical, and both are INTRA_DC modes or INTRA_PLANAR modes, the MPMcandidate list may be determined as below.

{INTRA_PLANAR, INTRA_DC, vertical, horizontal, 2(diagonal from bottomleft towards upper right), diagonal}

For example, when CandIntraPredModeA and CandIntraPredModeB areidentical, and none of CandIntraPredModeA and CandIntraPredModeB areINTRA_DC modes nor IINTRA_PLANAR modes, the MPM candidate list may bederived as below.

{CandIntraPredModeA, INTRA_PLANAR, CandIntraPredModeA+1,CandIntraPredModeA−1, CandIntraPredModeA+2, INTRA_DC}

For example, when CandIntraPredModeA and CandIntraPredModeB are notidentical, the MPM candidate list may be determined as following byconsidering an additional condition.

-   -   When none of CandIntraPredModeA and CandIntraPredModeB are        INTRA_PLANAR modes, and one of the two is an INTRA_DC mode, the        WM candidate list may be determined as below.

{CandIntraPredModeA, CandIntraPredModeB, INTRA_PLANAR,max(CandIntraPredModeA, CandIntraPredModeB)−1, max(CandIntraPredModeA,CandIntaPredModeB)+1, max(CandIntraPredModeA, CandIntraPredModeB)+2}

-   -   When none of CandIntraPredModeA and CandIntraPredModeB are        INTRA_PLANAR modes nor INTRA_DC modes, the MPM candidate list        may be determined as below.

{CandIntraPredModeA, CandIntraPredModeB, INTRA_PLANAR,max(CandIntraPredModeA, CandIntraPredModeB)−1, max(CandIntraPredModeA,CandIntraPredModeB)+1, max(CandIntraPredModeA, CandIntraPredModeB)+2}

-   -   When at least one of CandIntraPredModeA and CandIntraPredModeB        is an INTRA_PLANAR mode, and        CandIntraPredModeA+CandIntraPredModeB <2, the MPM candidate list        may be determined as below.

{CandIntraPredModeA, CandIntraPredModeB, vertical or INTRA_DC,horizontal, 2, diagonal}

-   -   Otherwise, the MPM candidate list may be determined as below.

{CandIntraPredModeA, CandIntraPredModeB, vertical or INTRA_DC,max(CandIntraPredModeA, CandIntraPredModeB)−1, max(CandIntraPredModeA,CandIntraPredModeB)+1, max(CandIntraPredModeA, CandIntraPredModeB)+2}

When an intra prediction mode IntraPredModeY of a current block isincluded in an MPM candidate list candModeList[x], that is,prev_intra_luma_pred_flag==1, an intra prediction mode may beencoded/decoded to an index of the MPM candidate list.

When the intra prediction mode IntraPredModeY of the current block isnot included in the MPM candidate list (candModeList[x]), that is,prev_intra_luma_pred_flag==0, the intra prediction mode may beencoded/decoded by using K-bit binarized rem_intra_luma_pred_mode.Herein, K may be a positive integer.

For example, in order to decode an intra prediction mode from encodedrem_intra_luma_pred_mode, prediction mode candidates included incandModeList[x] may be sorted in ascending order. When L prediction modecandidates which are equal to or less than rem_intra_luma_pred_mode bycomparing therebetween are present among the sorted candModeList[x], anintra prediction mode selected by an encoding/decoding target block maybe derived as IntraPredModeY=rem_intra_luma_pred_mode+L.

FIG. 46 is a view showing encoding/decoding of an intra prediction modeof a current block of a chroma component.

The intra prediction mode of the current block of the chroma componentmay be encoded/decoded by using intra prediction mode informationintra_chroma_pred_mode on the chroma component and/or an intraprediction mode selected by a corresponding luma component block.

For example, an intra prediction mode IntraPredModeC of the currentblock of the chroma component may be encoded/decoded by usingintra_chroma_pred_mode as shown in FIG. 46 . IntraPredModeC may bedetermined according to an index of intra_chroma_pred_mode and an intraprediction mode IntraPredModeY selected by a corresponding lumacomponent block.

The decoding/encoding of the intra prediction mode of the current blockof the chroma component may be determined independent to the intraprediction mode selected by the corresponding luma component block.

For example, the intra prediction mode IntraPredModeC of the currentblock of the chroma component may be determined by the index ofintra_chroma_pred_mode.

The intra encoding/decoding process may be performed for each of lumaand chroma signals. For example, in the intra encoding/decoding process,at least one method of deriving an intra prediction mode, dividing ablock, constructing reference samples and performing intra predictionmay be differently applied for a luma signal and a chroma signal.

The intra encoding/decoding process may be equally performed for lumaand chroma signals. For example, in the intra encoding/decoding processbeing applied for the luma signal, at least one of deriving an intraprediction mode, dividing a block, constructing reference samples andperforming intra prediction may be equally applied to the chroma signal.

The methods may be performed in the encoder and the decoder in the samemanner. For example, in the intra encoding/decoding process, at leastone method of deriving an intra prediction mode, dividing a block,constructing reference samples and performing intra prediction may beapplied in the encoder and the decoder equally. In addition, orders ofapplying the methods may be different in the encoder and the decoder.For example, in performing intra encoding/decoding for the currentblock, an encoder may encode an intra prediction mode determined byperforming at least one intra prediction after constructing referencesamples.

The embodiments of the present invention may be applied according to thesize of at least one of a coding block, a prediction block, a block, anda unit. Here, the size may be defined as the minimum size and/or themaximum size in order to apply the embodiments, and may be defined as afixed size to which the embodiment is applied. In addition, a firstembodiment may be applied in a first size, and a second embodiment maybe applied in a second size. That is, the embodiments may be multiplyapplied according to the size. In addition, the embodiments of thepresent invention may be applied only when the size is equal to orgreater than the minimum size and is equal to or less than the maximumsize. That is, the embodiments may be applied only when the block sizeis in a predetermined range.

For example, only when the size of the encoding/decoding target block isequal to or greater than 8×8, the embodiments may be applied. Forexample, only when the size of the encoding decoding target block isequal to or greater than 16×16, the embodiments may be applied. Forexample, only when the size of the encoding/decoding target block isequal to or greater than 32×32, the embodiments may be applied. Forexample, only when the size of the encoding/decoding target block isequal to or greater than 64×64, the embodiments may be applied. Forexample, only when the size of the encoding/decoding target block isequal to or greater than 128×128, the embodiments may be applied. Forexample, only when the size of the encoding/decoding target block is4×4, the embodiments may be applied. For example, only when the size ofthe encoding/decoding target block is equal to or less than 8×8, theembodiments may be applied. For example, only when the size of theencoding/decoding target block is equal to or greater than 16×16, theembodiments may be applied. For example, only when the size of theencoding/decoding target block is equal to or greater than 8×8 and isequal to or less than 16×16, the embodiments may be applied. Forexample, only when the size of the encoding/decoding target block isequal to or greater than 16×16 and is equal to or less than 64×64, theembodiments may be applied.

The embodiments of the present invention may be applied according to atemporal layer. An identifier for identifying the temporal layer towhich the embodiment can be applied may be signaled, and the embodimentsmay be applied for the temporal layer specified by the identifier. Here,the identifier may be defined as indicating the minimum layer and/or themaximum layer to which the embodiment can be applied, and may be definedas indicating a particular layer to which the embodiment can be applied.

For example, only when the temporal layer of the current picture is thelowest layer, the embodiments may be applied. For example, only when atemporal layer identifier of the current picture is zero, theembodiments may be applied. For example, only when the temporal layeridentifier of the current picture is equal to or greater than one, theembodiments may be applied. For example, only when the temporal layer ofthe current picture is the highest layer, the embodiments may beapplied.

As described in the embodiment of the present invention, a referencepicture set used in processes of reference picture list construction andreference picture list modification may use at least one of referencepicture lists L0, L1, L2, and L3.

According to the embodiments of the present invention, when a deblockingfilter calculates boundary strength, at least one to at most N motionvectors of the encoding/decoding target block may be used. Here, Nindicates a positive integer equal to or greater than 1 such as 2, 3, 4,etc.

In motion vector prediction, when the motion vector has at least one ofa 16-pixel (16-pel) unit, a 8-pixel (8-pel) unit, a 4-pixel (4-pel)unit, an integer-pixel (integer-pet) unit, a 1/2-pixel (1/2-pel) unit, a1/4-pixel (1/4-pel) unit, a 1/8-pixel (1/8-pel) unit, a 1/16-pixel(1/16-pel) unit, a 1/32-pixel (1/32-pel) unit, and a 1/64-pixel(1/64-pel) unit, the embodiments of the present invention may beapplied. In addition, in performing motion vector prediction, the motionvector may be optionally used for each pixel unit.

A slice type to which the embodiments of the present invention may bedefined and the embodiments of the present invention may be appliedaccording to the slice type.

For example, when the slice type is a T (Tri-predictive)-slice, aprediction block may be generated by using at least three motionvectors, and may be used as the final prediction block of the encodingdecoding target block by calculating a weighted sum of at least threeprediction blocks.

For example, when the slice type is a Q (Quad-predictive)-slice, aprediction block may be generated by using at least four motion vectors,and may be used as the final prediction block of the encoding/decodingtarget block by calculating a weighted sum of at least four predictionblocks.

The embodiment of the present invention may be applied to interprediction and motion compensation methods using motion vectorprediction as well as inter prediction and motion compensation methodsusing a skip mode, a merge mode, etc.

The shape of the block to which the embodiments of the present inventionis applied may have a square shape or a non-square shape.

In the above-described embodiments, the methods are described based onthe flowcharts with a series of steps or units, but the presentinvention is not limited to the order of the steps, and rather, somesteps may be performed simultaneously or in different order with othersteps. In addition, it should be appreciated by one of ordinary skill inthe art that the steps in the flowcharts do not exclude each other andthat other steps may be added to the flowcharts or some of the steps maybe deleted from the flowcharts without influencing the scope of thepresent invention.

The embodiments include various aspects of examples. All possiblecombinations for various aspects may not be described, but those skilledin the art will be able to recognize different combinations.Accordingly, the present invention may include all replacements,modifications, and changes within the scope of the claims.

The embodiments of the present invention may be implemented in a form ofprogram instructions, which are executable by various computercomponents, and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include stand-alone or acombination of program instructions, data files, data structures, etc.The program instructions recorded in the computer-readable recordingmedium may be specially designed and constructed for the presentinvention, or well-known to a person of ordinary skilled in computersoftware technology field. Examples of the computer-readable recordingmedium include magnetic recording media such as hard disks, floppydisks, and magnetic tapes; optical data storage media such as CD-ROMscar DVD-ROMs; magneto-optimum media such as floptical disks; andhardware devices, such as read-only memory (ROM), random-access memory(RAM), flash memory, etc., which are particularly structured to storeand implement the program instruction. Examples of the programinstructions include not only a mechanical language code formatted by acompiler but also a high level language code that may be implemented bya computer using an interpreter. The hardware devices may be configuredto be operated by one or more software modules or vice versa to conductthe processes according to the present invention.

Although the present invention has been described in terms of specificitems such as detailed elements as well as the limited embodiments andthe drawings, they are only provided to help more general understandingof the invention, and the present invention is not limited to the aboveembodiments. It will be appreciated by those skilled in the art to whichthe present invention pertains that various modifications and changesmay be made from the above description.

Therefore, the spirit of the present invention shall not be limited tothe above-described embodiments, and the entire scope of the appendedclaims and their equivalents will fall within the scope and spirit ofthe invention.

INDUSTRIAL APPLICABILITY

The present invention may be used in encoding/decoding an image.

1. An image decoding method performed by a decoding apparatus, themethod comprising: obtaining image information comprising information onquantized transform coefficient levels through a bitstream; deriving aprediction mode for a current block as one of inter mode or intra mode;generating a predicted block of the current block based on the intermode or the intra mode; deriving transform coefficients based on theinformation on quantized transform coefficient levels; determining atransform set for the current block; deriving a reconstructed residualsignal by performing inverse-transform based on the transformcoefficients and a transform candidate in the transform set; andgenerating a reconstructed block based on the predicted block and thereconstructed residual signal, wherein at least one of a number or typesof transform candidates of the transform set are determined differentlybased on whether the inter mode or the intra mode is used for thecurrent block.
 2. The method of claim 1, wherein the transform set isone of transform sets including a first transform set for the intra modeand a second transform set for the inter mode, wherein a number oftransform candidates of the first transform set is different from anumber of transform candidates of the second transform set.
 3. Themethod of claim 1, wherein the transform set is one of transform setsincluding a first transform set for the intra mode and a secondtransform set for the inter mode, wherein types of transform candidatesof the first transform set are different from types of transformcandidates of the second transform set.
 4. The method of claim 1,wherein at least one of the number or the types of transform candidatesof the transform set are determined differently further based on a sizeof the current block.
 5. The method of claim 1, wherein the transformset includes a 2-dimensional (2D) transform candidate.
 6. The method ofclaim 1, wherein the transform set includes a 2-dimensional (2D)transform candidate and a 1-dimensional (1D) transform candidate.
 7. Animage encoding method performed by an encoding apparatus, the methodcomprising: deriving a prediction mode for a current block as one ofinter mode or intra mode; generating predicted block of the currentblock based on the inter mode or the intra mode; deriving a residualsignal based on the predicted block; determining a transform set for thecurrent block; deriving transform coefficients by performing transformbased on the residual signal and a transform candidate in the transformset; deriving quantized transform coefficient levels based on thetransform coefficients; and encoding image information includinginformation on the quantized transform coefficient levels; wherein atleast one of a number or types of transform candidates of the transformset are determined differently based on whether the inter mode or theintra mode is used for the current block.
 8. The method of claim 7,wherein the transform set is one of transform sets including a firsttransform set for the intra mode and a second transform set for theinter mode, wherein a number of transform candidates of the firsttransform set is different from a number of transform candidates of thesecond transform set.
 9. The method of claim 7, wherein the transformset is one of transform sets including a first transform set for theintra mode and a second transform set for the inter mode, wherein typesof transform candidates of the first transform set are different fromtypes of transform candidates of the second transform set.
 10. Themethod of claim 7, wherein at least one of the number or the types oftransform candidates of the transform set are determined differentlyfurther based on a size of the current block.
 11. The method of claim 7,wherein the transform set includes a 2-dimensional (2D) transformcandidate.
 12. The method of claim 7, wherein the transform set includesa 2-dimensional (2-D) transform candidate and a 1-dimensional (1D)transform candidate.
 13. A transmission method for image data, themethod comprising: obtaining a bitstream of encoded image information,wherein the encoded image information is generated based on deriving aprediction mode for a current block as one of inter mode or intra mode,generating predicted block of the current block based on the inter modeor the intra mode, deriving a residual signal based on the predictedblock, determining a transform set for the current block, derivingtransform coefficients by performing transform based on the residualsignal and a transform candidate in the transform set, derivingquantized transform coefficient levels based on the transformcoefficients, and encoding image information including information onthe quantized transform coefficient levels; and transmitting the imagedata comprising the bitstream, wherein at least one of a number or typesof transform candidates of the transform set are determined differentlybased on whether the inter mode or the intra mode is used for thecurrent block.
 14. The method of claim 13, wherein the transform set isone of transform sets including a first transform set for the intra modeand a second transform set for the inter mode, wherein a number oftransform candidates of the first transform set is different from anumber of transform candidates of the second transform set.
 15. Themethod of claim 13, wherein the transform set s one of transform setsincluding a first transform set for the intra mode and a secondtransform set for the inter mode, wherein types of transform candidatesof the first transform set are different from types of transformcandidates of the second transform set.
 16. The method of claim 13,wherein at least one of the number or the types of transform candidatesof the transform set are determined differently further based on a sizeof the current block.
 17. The method of claim 13, wherein the transformset includes a 2-dimensional (2D) transform candidate.
 18. The method ofclaim 13, wherein the transform set includes a 2-dimensional (21))transform candidate and a 1-dimensional (1D) transform candidate.